{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "            <div id=\"kotlin_out_0\"/>\n",
       "            <script type=\"text/javascript\">\n",
       "                            if(!window.kotlinQueues) {\n",
       "                window.kotlinQueues = {};\n",
       "            }\n",
       "            if(!window.kotlinQueues[\"DataFrame\"]) {\n",
       "                var resQueue = [];\n",
       "                window.kotlinQueues[\"DataFrame\"] = resQueue;\n",
       "                window[\"call_DataFrame\"] = function(f) {\n",
       "                    resQueue.push(f);\n",
       "                }\n",
       "            }\n",
       "            (function (){\n",
       "                var modifiers = [(function(script) {\n",
       "    script.src = \"https://cdn.jsdelivr.net/gh/Kotlin/dataframe@d6467c1389bc031958acd5310fce39167b5cc581/src/main/resources/init.js\"\n",
       "    script.type = \"text/javascript\";\n",
       "})];\n",
       "                var e = document.getElementById(\"kotlin_out_0\");\n",
       "                modifiers.forEach(function (gen) {\n",
       "                    var script = document.createElement(\"script\");\n",
       "                    gen(script)\n",
       "                    script.addEventListener(\"load\", function() {\n",
       "                        window[\"call_DataFrame\"] = function(f) {f();};\n",
       "                        window.kotlinQueues[\"DataFrame\"].forEach(function(f) {f();});\n",
       "                        window.kotlinQueues[\"DataFrame\"] = [];\n",
       "                    }, false);\n",
       "                    script.addEventListener(\"error\", function() {\n",
       "                        window[\"call_DataFrame\"] = function(f) {};\n",
       "                        window.kotlinQueues[\"DataFrame\"] = [];\n",
       "                        var div = document.createElement(\"div\");\n",
       "                        div.style.color = 'darkred';\n",
       "                        div.textContent = 'Error loading resource DataFrame';\n",
       "                        document.getElementById(\"kotlin_out_0\").appendChild(div);\n",
       "                    }, false);\n",
       "                    \n",
       "                    e.appendChild(script);\n",
       "                });\n",
       "            })();\n",
       "            </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "                <style>\n",
       "                :root {\n",
       "    --background: #fff;\n",
       "    --background-odd: #f5f5f5;\n",
       "    --background-hover: #d9edfd;\n",
       "    --header-text-color: #474747;\n",
       "    --text-color: #848484;\n",
       "    --text-color-dark: #000;\n",
       "    --text-color-medium: #737373;\n",
       "    --text-color-pale: #b3b3b3;\n",
       "    --inner-border-color: #aaa;\n",
       "    --bold-border-color: #000;\n",
       "    --link-color: #296eaa;\n",
       "    --link-color-pale: #296eaa;\n",
       "    --link-hover: #1a466c;\n",
       "}\n",
       "\n",
       ":root[theme=\"dark\"], :root [data-jp-theme-light=\"false\"]{\n",
       "    --background: #303030;\n",
       "    --background-odd: #3c3c3c;\n",
       "    --background-hover: #464646;\n",
       "    --header-text-color: #dddddd;\n",
       "    --text-color: #b3b3b3;\n",
       "    --text-color-dark: #dddddd;\n",
       "    --text-color-medium: #b2b2b2;\n",
       "    --text-color-pale: #737373;\n",
       "    --inner-border-color: #707070;\n",
       "    --bold-border-color: #777777;\n",
       "    --link-color: #008dc0;\n",
       "    --link-color-pale: #97e1fb;\n",
       "    --link-hover: #00688e;\n",
       "}\n",
       "\n",
       "table.dataframe {\n",
       "    font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
       "    font-size: 12px;\n",
       "    background-color: var(--background);\n",
       "    color: var(--text-color-dark);\n",
       "    border: none;\n",
       "    border-collapse: collapse;\n",
       "}\n",
       "\n",
       "table.dataframe th, td {\n",
       "    padding: 6px;\n",
       "    border: 1px solid transparent;\n",
       "    text-align: left;\n",
       "}\n",
       "\n",
       "table.dataframe th {\n",
       "    background-color: var(--background);\n",
       "    color: var(--header-text-color);\n",
       "}\n",
       "\n",
       "table.dataframe td {\n",
       "    vertical-align: top;\n",
       "}\n",
       "\n",
       "table.dataframe th.bottomBorder {\n",
       "    border-bottom-color: var(--bold-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(odd) {\n",
       "    background: var(--background-odd);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(even) {\n",
       "    background: var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:hover {\n",
       "    background: var(--background-hover);\n",
       "}\n",
       "\n",
       "table.dataframe a {\n",
       "    cursor: pointer;\n",
       "    color: var(--link-color);\n",
       "    text-decoration: none;\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover > td a {\n",
       "    color: var(--link-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe a:hover {\n",
       "    color: var(--link-hover);\n",
       "    text-decoration: underline;\n",
       "}\n",
       "\n",
       "table.dataframe img {\n",
       "    max-width: fit-content;\n",
       "}\n",
       "\n",
       "table.dataframe th.complex {\n",
       "    background-color: var(--background);\n",
       "    border: 1px solid var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe .leftBorder {\n",
       "    border-left-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightBorder {\n",
       "    border-right-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightAlign {\n",
       "    text-align: right;\n",
       "}\n",
       "\n",
       "table.dataframe .expanderSvg {\n",
       "    width: 8px;\n",
       "    height: 8px;\n",
       "    margin-right: 3px;\n",
       "}\n",
       "\n",
       "table.dataframe .expander {\n",
       "    display: flex;\n",
       "    align-items: center;\n",
       "}\n",
       "\n",
       "/* formatting */\n",
       "\n",
       "table.dataframe .null {\n",
       "    color: var(--text-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe .structural {\n",
       "    color: var(--text-color-medium);\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .dataFrameCaption {\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .numbers {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe td:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "\n",
       "                </style>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"vQOEcY\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "       if(!window.letsPlotCallQueue) {\n",
       "           window.letsPlotCallQueue = [];\n",
       "       }; \n",
       "       window.letsPlotCall = function(f) {\n",
       "           window.letsPlotCallQueue.push(f);\n",
       "       };\n",
       "       (function() {\n",
       "           var script = document.createElement(\"script\");\n",
       "           script.type = \"text/javascript\";\n",
       "           script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v2.4.0/js-package/distr/lets-plot.min.js\";\n",
       "           script.onload = function() {\n",
       "               window.letsPlotCall = function(f) {f();};\n",
       "               window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "               window.letsPlotCallQueue = [];\n",
       "               \n",
       "               \n",
       "           };\n",
       "           script.onerror = function(event) {\n",
       "               window.letsPlotCall = function(f) {};\n",
       "               window.letsPlotCallQueue = [];\n",
       "               var div = document.createElement(\"div\");\n",
       "               div.style.color = 'darkred';\n",
       "               div.textContent = 'Error loading Lets-Plot JS';\n",
       "               document.getElementById(\"vQOEcY\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"vQOEcY\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%useLatestDescriptors\n",
    "%use dataframe, lets-plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410176\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 14</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"pclass: Int\\\">pclass</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"name: String\\\">name</span>\", children: [], rightAlign: false, values: [\"Allen, Miss. Elisabeth Walton\",\"Allison, Master. Hudson Trevor\",\"Allison, Miss. Helen Loraine\",\"Allison, Mr. Hudson Joshua Creighton\",\"<span class=\\\"formatted\\\" title=\\\"Allison, Mrs. Hudson J C (Bessie Waldo Daniels)\\\">Allison, Mrs. Hudson J C (Bessie Wald<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sex: String?\\\">sex</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"male\",\"female\",\"male\",\"female\"] }, \n",
       "{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">29.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.9167</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">30.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">25.0000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sibsp: Int?\\\">sibsp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"parch: Int?\\\">parch</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"ticket: String\\\">ticket</span>\", children: [], rightAlign: false, values: [\"24160\",\"113781\",\"113781\",\"113781\",\"113781\"] }, \n",
       "{ name: \"<span title=\\\"fare: Double\\\">fare</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">211.3375</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"cabin: String\\\">cabin</span>\", children: [], rightAlign: false, values: [\"B5\",\"C22 C26\",\"C22 C26\",\"C22 C26\",\"C22 C26\"] }, \n",
       "{ name: \"<span title=\\\"embarked: String?\\\">embarked</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"AA\",\"S\",\"S\",\"S\"] }, \n",
       "{ name: \"<span title=\\\"boat: String?\\\">boat</span>\", children: [], rightAlign: false, values: [\"2\",\"11\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"body: Int?\\\">body</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">135</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"homedest: String\\\">homedest</span>\", children: [], rightAlign: false, values: [\"St Louis, MO\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\"] }, \n",
       "], id: -1023410176, rootId: -1023410176, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410176) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "var df = DataFrame.readCSV(fileOrUrl = \"../../idea-examples/titanic/src/main/resources/titanic.csv\", delimiter = ';', parserOptions = ParserOptions(locale = java.util.Locale.FRENCH))\n",
    "\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We have a dataset which uses an alternative pattern for decimal numbers. This is a reason why the French locale will be used in the example.\n",
    "\n",
    "But before data conversion, we should to handle *null* values."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410175\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 14, columnsCount = 12</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"name: String\\\">name</span>\", children: [], rightAlign: false, values: [\"pclass\",\"survived\",\"name\",\"sex\",\"age\",\"sibsp\",\"parch\",\"ticket\",\"fare\",\"cabin\",\"embarked\",\"boat\",\"body\",\"homedest\"] }, \n",
       "{ name: \"<span title=\\\"type: Any\\\">type</span>\", children: [], rightAlign: false, values: [\"Int\",\"Int\",\"String\",\"String\",\"Double\",\"Int\",\"Int\",\"String\",\"Double\",\"String\",\"String\",\"String\",\"Int\",\"String\"] }, \n",
       "{ name: \"<span title=\\\"count: Int\\\">count</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1309</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"unique: Int\\\">unique</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1307</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">99</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">9</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">929</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">282</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">187</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">28</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">122</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">370</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"nulls: Int\\\">nulls</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">263</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">823</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1188</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">564</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"top: java.io.Serializable\\\">top</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"Connolly, Miss. Kate\",\"male\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">24.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"CA. 2343\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8.1</span></span>\",\"C23 C25 C27\",\"S\",\"13\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">135</span></span>\",\"New York, NY\"] }, \n",
       "{ name: \"<span title=\\\"freq: Int\\\">freq</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">709</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">809</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">843</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">47</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">890</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">11</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">60</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">912</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">39</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">64</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"mean: Double?\\\">mean</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.294882</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.381971</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">29.881135</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.499235</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.385321</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">33.295479</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">160.809917</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"std: Double?\\\">std</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.837836</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.486055</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">14.413500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.041965</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.865826</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">51.758668</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">97.696922</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"min: java.io.Serializable\\\">min</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"Abbing, Mr. Anthony\",\"female\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"110152\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"A10\",\"AA\",\"1\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"?Havana, Cuba\"] }, \n",
       "{ name: \"<span title=\\\"median: java.io.Serializable\\\">median</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"Kink, Mr. Vincenz\",\"male\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">28.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"347082\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">14.5</span></span>\",\"C62 C64\",\"S\",\"3\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">155</span></span>\",\"Lyndhurst, England\"] }, \n",
       "{ name: \"<span title=\\\"max: java.io.Serializable\\\">max</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"van Melkebeke, Mr. Philemon\",\"male\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">80.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">9</span></span>\",\"WE/P 5735\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">512.3</span></span>\",\"T\",\"S\",\"D\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">328</span></span>\",\"Zurich, Switzerland\"] }, \n",
       "], id: -1023410175, rootId: -1023410175, totalRows: 14 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410175) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410174\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 1309 rows</p><p>DataFrame: rowsCount = 1309, columnsCount = 14</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"pclass: Int\\\">pclass</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"name: String\\\">name</span>\", children: [], rightAlign: false, values: [\"Allen, Miss. Elisabeth Walton\",\"Allison, Master. Hudson Trevor\",\"Allison, Miss. Helen Loraine\",\"Allison, Mr. Hudson Joshua Creighton\",\"<span class=\\\"formatted\\\" title=\\\"Allison, Mrs. Hudson J C (Bessie Waldo Daniels)\\\">Allison, Mrs. Hudson J C (Bessie Wald<span class=\\\"structural\\\">...</span></span>\",\"Anderson, Mr. Harry\",\"Andrews, Miss. Kornelia Theodosia\",\"Andrews, Mr. Thomas Jr\",\"<span class=\\\"formatted\\\" title=\\\"Appleton, Mrs. Edward Dale (Charlotte Lamson)\\\">Appleton, Mrs. Edward Dale (Charlotte<span class=\\\"structural\\\">...</span></span>\",\"Artagaveytia, Mr. Ramon\",\"Astor, Col. John Jacob\",\"<span class=\\\"formatted\\\" title=\\\"Astor, Mrs. John Jacob (Madeleine Talmadge Force)\\\">Astor, Mrs. John Jacob (Madeleine Tal<span class=\\\"structural\\\">...</span></span>\",\"Aubart, Mme. Leontine Pauline\",\"Barber, Miss. Ellen &#34;Nellie&#34;\",\"Barkworth, Mr. Algernon Henry Wilson\",\"Baumann, Mr. John D\",\"Baxter, Mr. Quigg Edmond\",\"<span class=\\\"formatted\\\" title=\\\"Baxter, Mrs. James (Helene DeLaudeniere Chaput)\\\">Baxter, Mrs. James (Helene DeLaudenie<span class=\\\"structural\\\">...</span></span>\",\"Bazzani, Miss. Albina\",\"Beattie, Mr. Thomson\"] }, \n",
       "{ name: \"<span title=\\\"sex: String?\\\">sex</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"male\",\"female\",\"male\",\"female\",\"male\",\"female\",\"male\",\"female\",\"male\",\"male\",\"female\",\"female\",\"female\",\"male\",\"male\",\"male\",\"female\",\"female\",\"male\"] }, \n",
       "{ name: \"<span title=\\\"age: Double?\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">29.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.9167</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">30.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">25.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">48.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">63.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">39.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">53.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">71.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">47.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">18.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">24.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">26.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">80.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">24.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">50.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">32.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">36.0000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sibsp: Int?\\\">sibsp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"parch: Int?\\\">parch</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"ticket: String\\\">ticket</span>\", children: [], rightAlign: false, values: [\"24160\",\"113781\",\"113781\",\"113781\",\"113781\",\"19952\",\"13502\",\"112050\",\"11769\",\"PC 17609\",\"PC 17757\",\"PC 17757\",\"PC 17477\",\"19877\",\"27042\",\"PC 17318\",\"PC 17558\",\"PC 17558\",\"11813\",\"13050\"] }, \n",
       "{ name: \"<span title=\\\"fare: Double?\\\">fare</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">211.3375</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">26.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">77.9583</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">51.4792</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">49.5042</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">227.5250</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">227.5250</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">69.3000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">78.8500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">30.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">25.9250</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">247.5208</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">247.5208</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">76.2917</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">75.2417</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"cabin: String?\\\">cabin</span>\", children: [], rightAlign: false, values: [\"B5\",\"C22 C26\",\"C22 C26\",\"C22 C26\",\"C22 C26\",\"E12\",\"D7\",\"A36\",\"C101\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"C62 C64\",\"C62 C64\",\"B35\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"A23\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"B58 B60\",\"B58 B60\",\"D15\",\"C6\"] }, \n",
       "{ name: \"<span title=\\\"embarked: String?\\\">embarked</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"AA\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"C\",\"C\",\"C\",\"C\",\"S\",\"S\",\"S\",\"C\",\"C\",\"C\",\"C\"] }, \n",
       "{ name: \"<span title=\\\"boat: String?\\\">boat</span>\", children: [], rightAlign: false, values: [\"2\",\"11\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"3\",\"10\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"D\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"4\",\"9\",\"6\",\"B\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"6\",\"8\",\"A\"] }, \n",
       "{ name: \"<span title=\\\"body: Int?\\\">body</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">135</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">22</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">124</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"homedest: String?\\\">homedest</span>\", children: [], rightAlign: false, values: [\"St Louis, MO\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"New York, NY\",\"Hudson, NY\",\"Belfast, NI\",\"Bayside, Queens, NY\",\"Montevideo, Uruguay\",\"New York, NY\",\"New York, NY\",\"Paris, France\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"Hessle, Yorks\",\"New York, NY\",\"Montreal, PQ\",\"Montreal, PQ\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"Winnipeg, MN\"] }, \n",
       "], id: -1023410174, rootId: -1023410174, totalRows: 1309 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410174) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imputing null values\n",
    "Let's convert all columns of our dataset to non-nullable and impute null values based on mean values."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410173\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 14</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"pclass: Int\\\">pclass</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"name: String\\\">name</span>\", children: [], rightAlign: false, values: [\"Allen, Miss. Elisabeth Walton\",\"Allison, Master. Hudson Trevor\",\"Allison, Miss. Helen Loraine\",\"Allison, Mr. Hudson Joshua Creighton\",\"<span class=\\\"formatted\\\" title=\\\"Allison, Mrs. Hudson J C (Bessie Waldo Daniels)\\\">Allison, Mrs. Hudson J C (Bessie Wald<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sex: String\\\">sex</span>\", children: [], rightAlign: false, values: [\"female\",\"male\",\"female\",\"male\",\"female\"] }, \n",
       "{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">29.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.9167</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">30.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">25.0000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sibsp: Double\\\">sibsp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"parch: Double\\\">parch</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"ticket: String\\\">ticket</span>\", children: [], rightAlign: false, values: [\"24160\",\"113781\",\"113781\",\"113781\",\"113781\"] }, \n",
       "{ name: \"<span title=\\\"fare: Double\\\">fare</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">211.3375</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"cabin: String\\\">cabin</span>\", children: [], rightAlign: false, values: [\"B5\",\"C22 C26\",\"C22 C26\",\"C22 C26\",\"C22 C26\"] }, \n",
       "{ name: \"<span title=\\\"embarked: String\\\">embarked</span>\", children: [], rightAlign: false, values: [\"S\",\"AA\",\"S\",\"S\",\"S\"] }, \n",
       "{ name: \"<span title=\\\"boat: String?\\\">boat</span>\", children: [], rightAlign: false, values: [\"2\",\"11\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"body: Int?\\\">body</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">135</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"homedest: String\\\">homedest</span>\", children: [], rightAlign: false, values: [\"St Louis, MO\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\"] }, \n",
       "], id: -1023410173, rootId: -1023410173, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410173) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val df1 = df\n",
    "    // imputing\n",
    "    .fillNulls { sibsp and parch and age and fare }.perCol { mean() }\n",
    "    .fillNulls { sex }.withValue(\"female\")\n",
    "    .fillNulls { embarked }.with { \"S\" }\n",
    "    .convert { sibsp and parch and age and fare }.toDouble()\n",
    "\n",
    "df1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pclass: Int\n",
       "survived: Int\n",
       "name: String\n",
       "sex: String\n",
       "age: Double\n",
       "sibsp: Double\n",
       "parch: Double\n",
       "ticket: String\n",
       "fare: Double\n",
       "cabin: String?\n",
       "embarked: String\n",
       "boat: String?\n",
       "body: Int?\n",
       "homedest: String?\n"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.schema()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410172\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 6, columnsCount = 7</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"column: String\\\">column</span>\", children: [], rightAlign: false, values: [\"pclass\",\"survived\",\"age\",\"sibsp\",\"parch\",\"fare\"] }, \n",
       "{ name: \"<span title=\\\"pclass: Double\\\">pclass</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.312469</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.366370</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.060832</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.018322</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.558477</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.312469</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.050199</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.027825</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.082660</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.244208</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.366370</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.050199</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.190747</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.130872</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.171521</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sibsp: Double\\\">sibsp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.060832</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.027825</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.190747</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.373587</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.160224</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"parch: Double\\\">parch</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.018322</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.082660</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.130872</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.373587</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.221522</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"fare: Double\\\">fare</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.558477</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.244208</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.171521</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.160224</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.221522</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\"] }, \n",
       "], id: -1023410172, rootId: -1023410172, totalRows: 6 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410172) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.corr()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410171\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 6, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"column: String\\\">column</span>\", children: [], rightAlign: false, values: [\"pclass\",\"age\",\"sibsp\",\"parch\",\"fare\",\"survived\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.312469</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.050199</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.027825</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.082660</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.244208</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\"] }, \n",
       "], id: -1023410171, rootId: -1023410171, totalRows: 6 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410171) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val correlations = df1.corr { all() }.with { survived }\n",
    "    .sortBy { survived }\n",
    "correlations"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Great, at this moment we have 5 numerical features available for numerical analysis: **pclass, age, sibsp, parch, fare**."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Analyze by pivoting features\n",
    "To confirm some of our observations and assumptions, we can quickly analyze our feature correlations by pivoting features against each other. We can only do so at this stage for features which do not have any empty values. It also makes sense doing so only for features which are categorical (Sex), ordinal (Pclass) or discrete (SibSp, Parch) type.\n",
    "\n",
    "- **Pclass**: We observe significant correlation (>0.5) among **Pclass**=1 and **Survived**.\n",
    "\n",
    "- **Sex**: We confirm the observation during problem definition that Sex=female had a very high survival rate at 74%.\n",
    "\n",
    "- **SibSp** and **Parch**: These features have zero correlation for the certain values. It may be best to derive a feature or a set of features from these individual features."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410170\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 3, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"pclass: Int\\\">pclass</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.619195</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.429603</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.255289</span></span>\"] }, \n",
       "], id: -1023410170, rootId: -1023410170, totalRows: 3 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410170) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.groupBy { pclass }.mean { survived }.sortBy { pclass }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410169\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 2, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"sex: String\\\">sex</span>\", children: [], rightAlign: false, values: [\"male\",\"female\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.190985</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.727468</span></span>\"] }, \n",
       "], id: -1023410169, rootId: -1023410169, totalRows: 2 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410169) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.groupBy { sex }.mean { survived }.sortBy { survived }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410168\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 7, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"sibsp: Double\\\">sibsp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.346801</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.510972</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.452381</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.300000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.136364</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\"] }, \n",
       "], id: -1023410168, rootId: -1023410168, totalRows: 7 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410168) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.groupBy { sibsp }.mean { survived }.sortBy { sibsp }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410167\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 8, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"parch: Double\\\">parch</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">9.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.335329</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.588235</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.504425</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.625000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.166667</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.166667</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000000</span></span>\"] }, \n",
       "], id: -1023410167, rootId: -1023410167, totalRows: 8 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410167) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.groupBy { parch }.mean { survived }.sortBy { parch }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Analyze the importance of the Age feature\n",
    "\n",
    "It's interesting to discover both **age** distributions: among survived and not survived passengers."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410166\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 99 rows</p><p>DataFrame: rowsCount = 99, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.166700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.333300</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.416700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.666700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.750000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.833300</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.916700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">7.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">9.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">10.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">11.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">11.500000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">12.000000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"count: Int\\\">count</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">10</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">12</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">7</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">10</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">10</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\"] }, \n",
       "], id: -1023410166, rootId: -1023410166, totalRows: 99 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410166) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val byAge = df1.valueCounts { age }.sortBy { age }\n",
    "byAge"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "// JetBrains color palette\n",
    "val colors = mapOf(\"light_orange\" to \"#ffb59e\", \"orange\" to \"#ff6632\", \"light_grey\" to \"#a6a6a6\", \"dark_grey\" to \"#4c4c4c\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"e95vGM\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "\"x\":\"age\",\n",
       "\"y\":\"count\"\n",
       "},\n",
       "\"data\":{\n",
       "\"count\":[1.0,1.0,1.0,1.0,3.0,3.0,2.0,10.0,12.0,7.0,10.0,5.0,6.0,4.0,6.0,10.0,4.0,4.0,1.0,3.0,5.0,8.0,2.0,6.0,19.0,20.0,39.0,3.0,29.0,23.0,1.0,41.0,43.0,1.0,26.0,1.0,47.0,1.0,34.0,30.0,1.0,30.0,32.0,3.0,30.0,263.0,40.0,2.0,23.0,24.0,4.0,21.0,16.0,2.0,23.0,31.0,2.0,9.0,14.0,1.0,20.0,18.0,3.0,11.0,18.0,9.0,10.0,21.0,2.0,6.0,14.0,14.0,9.0,15.0,8.0,6.0,4.0,10.0,8.0,1.0,4.0,5.0,6.0,3.0,7.0,1.0,5.0,5.0,4.0,5.0,3.0,1.0,1.0,2.0,1.0,2.0,1.0,1.0,1.0],\n",
       "\"age\":[0.1667,0.3333,0.4167,0.6667,0.75,0.8333,0.9167,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,11.5,12.0,13.0,14.0,14.5,15.0,16.0,17.0,18.0,18.5,19.0,20.0,20.5,21.0,22.0,22.5,23.0,23.5,24.0,24.5,25.0,26.0,26.5,27.0,28.0,28.5,29.0,29.8811345124283,30.0,30.5,31.0,32.0,32.5,33.0,34.0,34.5,35.0,36.0,36.5,37.0,38.0,38.5,39.0,40.0,40.5,41.0,42.0,43.0,44.0,45.0,45.5,46.0,47.0,48.0,49.0,50.0,51.0,52.0,53.0,54.0,55.0,55.5,56.0,57.0,58.0,59.0,60.0,60.5,61.0,62.0,63.0,64.0,65.0,66.0,67.0,70.0,70.5,71.0,74.0,76.0,80.0]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":850.0,\n",
       "\"height\":500.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"color\":\"#4c4c4c\",\n",
       "\"size\":5.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"data\":{\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"e95vGM\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "letsPlot(byAge.toMap()) { x = \"age\"; y = \"count\" } + \n",
    "    geomPoint(size = 5, color = colors[\"dark_grey\"]) +\n",
    "    ggsize(850, 500)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"0Jjk2I\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "\"x\":\"age\"\n",
       "},\n",
       "\"data\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":850.0,\n",
       "\"height\":500.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"bin\",\n",
       "\"position\":\"stack\",\n",
       "\"binwidth\":5.0,\n",
       "\"geom\":\"histogram\",\n",
       "\"fill\":\"#ff6632\",\n",
       "\"data\":{\n",
       "\"..count..\":[22.0,40.0,29.0,43.0,156.0,184.0,160.0,123.0,76.0,66.0,60.0,33.0,27.0,18.0,6.0,2.0,1.0,0.0],\n",
       "\"age\":[-0.8332999999999999,4.1667000000000005,9.1667,14.1667,19.1667,24.1667,29.1667,34.1667,39.1667,44.1667,49.1667,54.1667,59.1667,64.1667,69.1667,74.1667,79.1667,84.1667]\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"0Jjk2I\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val age = df.select { age }.dropNulls().sortBy { age }\n",
    "\n",
    "letsPlot(age.toMap()) { x = \"age\" } + geomHistogram(binWidth=5, fill = colors[\"orange\"]) + ggsize(850, 500)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410165\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 99 rows</p><p>DataFrame: rowsCount = 99, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.166700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.333300</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.416700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.666700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.750000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.833300</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.916700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">7.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">9.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">10.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">11.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">11.500000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">12.000000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"1: Int\\\">1</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">7</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">7</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"0: Int\\\">0</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: DataRow\\\">survived</span>\", children: [1, 2], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"1: 1\\n0: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 0\\n0: 1\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 1\\n0: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 1\\n0: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 2\\n0: 1\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">2</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 3\\n0: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">3</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 2\\n0: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">2</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 7\\n0: 3\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">7</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">3</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 4\\n0: 8\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">4</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">8</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 5\\n0: 2\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">5</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">2</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 7\\n0: 3\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">7</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">3</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 4\\n0: 1\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">4</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 3\\n0: 3\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">3</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">3</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 2\\n0: 2\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">2</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">2</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 4\\n0: 2\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">4</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">2</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 4\\n0: 6\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">4</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">6</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 0\\n0: 4\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">4</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 1\\n0: 3\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">3</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 0\\n0: 1\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 3\\n0: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">3</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">0: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "], id: -1023410165, rootId: -1023410165, totalRows: 99 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410165) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.groupBy { age }.pivotCounts { survived }.sortBy { age }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410164\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 1309 rows</p><p>DataFrame: rowsCount = 1309, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.166700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.333300</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.416700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.666700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.750000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.750000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.750000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.833300</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.833300</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.833300</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.916700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.916700</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.000000</span></span>\"] }, \n",
       "], id: -1023410164, rootId: -1023410164, totalRows: 1309 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410164) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val survivedByAge = df1.select { survived and age }.sortBy { age }\n",
    "survivedByAge"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"6RragG\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":850.0,\n",
       "\"height\":500.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"values\":[\"#4c4c4c\",\"#ff6632\"]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"age\",\n",
       "\"fill\":\"survived\"\n",
       "},\n",
       "\"stat\":\"bin\",\n",
       "\"alpha\":0.7,\n",
       "\"position\":\"dodge\",\n",
       "\"binwidth\":5.0,\n",
       "\"geom\":\"histogram\",\n",
       "\"data\":{\n",
       "\"..count..\":[17.0,23.0,11.0,23.0,51.0,74.0,134.0,55.0,24.0,26.0,27.0,18.0,9.0,6.0,0.0,1.0,1.0,0.0,5.0,17.0,18.0,20.0,105.0,110.0,289.0,68.0,52.0,40.0,33.0,15.0,18.0,12.0,6.0,1.0,0.0,0.0],\n",
       "\"survived\":[\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\"],\n",
       "\"age\":[-0.8332999999999999,4.1667000000000005,9.1667,14.1667,19.1667,24.1667,29.1667,34.1667,39.1667,44.1667,49.1667,54.1667,59.1667,64.1667,69.1667,74.1667,79.1667,84.1667,-0.8332999999999999,4.1667000000000005,9.1667,14.1667,19.1667,24.1667,29.1667,34.1667,39.1667,44.1667,49.1667,54.1667,59.1667,64.1667,69.1667,74.1667,79.1667,84.1667]\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"6RragG\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val plot = letsPlot(survivedByAge.convert { survived }.with { if (it == 1) \"Survived\" else \"Died\" }.toMap())\n",
    "\n",
    "plot +\n",
    "    geomHistogram(binWidth = 5, alpha = 0.7, position = Pos.dodge) { x = \"age\"; fill = \"survived\" } +\n",
    "    scaleFillManual(listOf(colors[\"dark_grey\"]!!, colors[\"orange\"]!!)) +\n",
    "    ggsize(850, 500)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"e0DgX7\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":850.0,\n",
       "\"height\":250.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"color\",\n",
       "\"values\":[\"#4c4c4c\",\"#ff6632\"]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"age\",\n",
       "\"color\":\"survived\"\n",
       "},\n",
       "\"stat\":\"density\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"density\",\n",
       "\"data\":{\n",
       "\"survived\":[\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\"],\n",
       "\"..density..\":[0.007654977161577824,0.00789697764730978,0.008128536595680452,0.008348604588393834,0.008556214476971516,0.00875049064446262,0.008930656989875455,0.009096043524824736,0.009246091500544394,0.00938035701331069,0.009498513066656415,0.009600350098746371,0.009685775012187668,0.009754808770673902,0.00980758265160677,0.009844333265696361,0.009865396473103673,0.009871200340681608,0.009862257296112183,0.009839155642183649,0.009802550598146801,0.009753155035187568,0.009691730069784788,0.009619075672391425,0.009536021439832761,0.009443417668452218,0.009342126851756994,0.009233015711537429,0.00911694785555979,0.008994777138347317,0.008867341784627978,0.008735459318062666,0.008599922321167928,0.008461495036162914,0.00832091080102112,0.00817887030047955,0.00803604059830607,0.007893054904887337,0.007750513023278766,0.007608982407358255,0.007468999757719331,0.0073310730744998295,0.007195684081521811,0.007063290932958587,0.006934331112273478,0.0068092244334003954,0.006688376056039224,0.006572179430491366,0.006461019092578827,0.00635527323579418,0.0062553159957591,0.006161519391189232,0.006074254875643997,0.005993894465172513,0.005920811418285274,0.005855380456214244,0.005797977522890892,0.005748979095173096,0.005708761064329932,0.005677697219356542,0.005656157371138471,0.005644505163586343,0.005643095623489568,0.005652272504870158,0.005672365486018245,0.005703687278161227,0.005746530703926626,0.0058011658015205214,0.005867837007025458,0.005946760462637219,0.00603812149323015,0.006142072287649609,0.0062587298148245075,0.0063881739984486844,0.006530446167851039,0.0066855477969734,0.006853439538315024,0.007034040554396006,0.007227228145875694,0.007432837672939992,0.007650662764958254,0.007880455812628867,0.008121928736764233,0.008374754028365588,0.008638566055489216,0.008912962633419353,0.009197506855582417,0.009491729183243872,0.009795129792108961,0.010107181173289638,0.010427330984568701,0.010755005145355313,0.011089611165144895,0.01143054169066765,0.011777178251306489,0.012128895175925669,0.01248506364717107,0.012845055851843624,0.013208249178415142,0.013574030405495442,0.013941799818451074,0.014310975185794874,0.014680995522799209,0.015051324567398928,0.01542145389314029,0.01579090558599858,0.016159234416499368,0.01652602944587023,0.01689091501492765,0.01725355107700951,0.017613632851298817,0.017970889790077736,0.018325083872414865,0.018676007257045272,0.01902347934820619,0.019367343349309087,0.019707462399906783,0.020043715410746288,0.020375992729090804,0.020704191781261056,0.021028212850851602,0.021347955158722804,0.021663313414184773,0.02197417500534305,0.02228041799012461,0.02258191003785518,0.02287850845443923,0.023170061402302062,0.023456410399572594,0.023737394151933554,0.024012853735664304,0.024282639112364196,0.024546616915388245,0.02480467940611108,0.025056754455615927,0.025302816365408445,0.025542897300241438,0.025777099068238704,0.026005604949297583,0.02622869124325473,0.02644673818556929,0.026660239861239,0.026869812738192635,0.027076202440257994,0.02728028838761348,0.02748308594990902,0.027685745784268977,0.027889550067339345,0.02809590537732453,0.028306332038263604,0.028522449804128543,0.028745959833856395,0.02897862298912721,0.029222234573275867,0.029478595720568122,0.029749481738416832,0.030036607798874695,0.030341592467695775,0.030665919647025332,0.031010899588799695,0.031377629707711324,0.03176695598253972,0.0321794357803373,0.03261530296712425,0.033074436179361004,0.03355633112090898,0.034060077719186906,0.0345843429210961,0.035127359833868055,0.035686923818741514,0.03626039602748724,0.03684471473504916,0.03743641466847613,0.03803165436601417,0.03862625142438653,0.03921572531120551,0.039795347237628856,0.04036019640879169,0.040905221801112654,0.041425308461329816,0.041915347186796834,0.04237030633459357,0.04278530442226716,0.04315568212871601,0.043477072282290086,0.043745466436102436,0.04395727667832587,0.0441093914073856,0.044199223916850224,0.04422475277991678,0.04418455319510242,0.04407781864873245,0.04390437246090854,0.04366466900419655,0.04335978461220578,0.042991398422334126,0.04256176361696465,0.04207366973436978,0.041530396908889405,0.040935663064660836,0.04029356522407298,0.03960851619783818,0.03888517799584012,0.038128393335371574,0.037343116625848896,0.03653434577737133,0.035707056116442364,0.0348661375985151,0.03401633638732194,0.03316220172941254,0.03230803889364761,0.03145786877464725,0.030615394581546735,0.029783975854066433,0.02896660987184652,0.028165920354888643,0.027384153196975666,0.026623178833712464,0.025884500725271056,0.02516926933325449,0.024478300892746326,0.023812100225289838,0.023170886806188583,0.022554623289392194,0.021963045703989072,0.02139569456604763,0.020851946195928103,0.020331043591539123,0.01983212627946962,0.019354258645492707,0.01889645633061661,0.018457710365755706,0.018037008804506326,0.017633355696976463,0.017245787326021587,0.01687338569881104,0.016515289350025764,0.016170701567207926,0.015838896193285934,0.015519221195910479,0.015211100218131591,0.014914032340623872,0.014627590292865825,0.01435141735037899,0.014085223148433922,0.01382877863074517,0.013581910335848532,0.013344494205304723,0.013116449077761352,0.012897730012288946,0.01268832156419688,0.012488231117488098,0.012297482360800607,0.012116108978505685,0.011944148615796249,0.011781637166150702,0.011628603421387515,0.011485064118396279,0.01135101941220324,0.01122644880189203,0.011111307533600687,0.011005523502896731,0.01090899467684731,0.01082158705366078,0.010743133174552227,0.010673431198239056,0.010612244543065065,0.010559302095146411,0.01051429897320189,0.010476897832044528,0.01044673067733346,0.010423401154449808,0.010406487264663061,0.010395544452517882,0.010390109000037562,0.010389701656328557,0.010393831425871318,0.010401999435520379,0.010413702799264438,0.010428438401267845,0.010445706521684119,0.010465014236138848,0.010485878528457813,0.01050782906688901,0.010530410606366312,0.01055318499283495,0.010575732759790794,0.010597654321423669,0.010618570780529272,0.010638124382104682,0.010655978654746299,0.01067181829115972,0.010685348825887194,0.010696296172475306,0.010704406083574472,0.010709443595836376,0.010711192517032932,0.01070945500576648,0.010704051284792347,0.010694819517754183,0.010681615866545455,0.010664314733125712,0.010642809176044633,0.010617011478777211,0.010586853834853584,0.010552289104233361,0.010513291586922598,0.010469857753861438,0.010422006871922646,0.010369781459629851,0.010313247512981412,0.010252494446470826,0.010187634702822964,0.010118802995792724,0.010046155163174541,0.009969866621434733,0.009890130428528973,0.009807154976890458,0.009721161353639813,0.009632380419161523,0.009541049667730306,0.009447409944339933,0.009351702099841734,0.009254163671608258,0.009155025678961811,0.009054509621446313,0.008952824763680272,0.008850165783149174,0.00874671084712294,0.00864262017227661,0.008538035105991841,0.008433077752244637,0.008327851148007827,0.008222439978818294,0.008116911805186535,0.008011318755454605,0.007905699626093896,0.00780008231778052,0.0076944865253176075,0.007588926591931604,0.007483414433891603,0.007377962439919641,0.0072725862514975495,0.007167307334845796,0.00706215526285951,0.006957169635349139,0.006852401578176632,0.006747914775859959,0.006643786007445901,0.006540105171395186,0.006436974801340426,0.0063345090903297535,0.006232832456040748,0.006132077692968318,0.0060323837693408485,0.005933893336156387,0.005836750022992272,0.005741095599954146,0.0056470670872126915,0.0055547938930428755,0.005464395058234211,0.0053759766793710926,0.005289629576052618,0.005205427257959544,0.005123424237158575,0.005043654719572204,0.004966131697564541,0.004890846453530443,0.004817768472641649,0.004746845751885664,0.004678005482572601,0.004611155074869537,0.004546183485875463,0.004482962807426078,0.004421350066298225,0.004361189187776215,0.0043023130735851366,0.004244545746861266,0.004187704519933891,0.0041316021450045265,0.004076048913062218,0.004020854672278205,0.003965830743380658,0.003910791715824069,0.0038555571146588717,0.0037999529336210577,0.00374381303488277,0.0036869804199611425,0.0036293083793521004,0.0035706615304697876,0.0035109167544167706,0.003449964042022862,0.0033877072585584284,0.0033240648346809796,0.003258970388675978,0.0031923732820955935,0.003124239107689702,0.0030545501052753974,0.0029833054981144753,0.002910521739658996,0.0028362326583565374,0.00276048948672342,0.0026833607602039077,0.0026049320715042213,0.0025253056671481833,0.0024445998749298933,0.00236294835368015,0.002280499160222564,0.0021974136324446566,0.002113865091894214,0.0020300373740586384,0.0019461231993100501,0.0018623224022128206,0.0017788400413102777,0.0016958844154609236,0.0016136650161301717,0.0015323904476328115,0.0014522663490656351,0.0013734933525031447,0.0012962651119190222,0.0012207664362452525,0.0011471715580243197,0.0010756425663145106,0.0010063280289672905,9.393618252262045E-4,8.748622049321082E-4,8.129310856070601E-4,7.53653593481233E-4,6.970978492776063E-4,6.433149944267846E-4,5.923394484890488E-4,5.44189384037827E-4,4.988674012175713E-4,4.563613807180193E-4,4.166454910738443E-4,3.7968132404890895E-4,3.4541913042136703E-4,3.137991277511783E-4,2.847528516679356E-4,2.5820452282841435E-4,2.3407240290938174E-4,2.1227011475856636E-4,1.9270790405262489E-4,1.7529382242552493E-4,1.5993481495069385E-4,1.4653769800034976E-4,1.3501001678163565E-4,1.252607751802164E-4,1.1720103385126773E-4,1.1074437571417057E-4,1.0580724106666885E-4,1.0230913737975912E-4,1.0017273141702181E-4,9.932383360015059E-5,9.969128648262258E-5,1.0120677077001015E-4,1.0380454352020341E-4,1.0742112395894914E-4,1.1199494275196837E-4,1.174659705878934E-4,1.2377534155661558E-4,1.3086498607249E-4,1.386772870149477E-4,1.471547713707913E-4,1.5623984799952546E-4,1.6587460024821145E-4,1.7600064006398987E-4,1.8655902804381858E-4,1.9749026157961098E-4,2.0873433096324831E-4,2.2023084107210982E-4,2.3191919412410717E-4,2.4373882703276073E-4,2.55629495165064E-4,2.6753159286017664E-4,2.7938649995055823E-4,2.911369427753183E-4,3.0272735781391985E-4,3.1410424611082877E-4,3.252165071088641E-4,3.3601574134819117E-4,3.464565126925844E-4,3.5649656227509284E-4,3.660969681594792E-4,3.7522224672908343E-4,3.83840393969385E-4,3.9192286702664076E-4,3.9944450862106247E-4,4.0638341898712474E-4,4.1272078192643776E-4,4.184406532168365E-4,4.235297209602965E-4,4.2797704841908066E-4,4.3177381044508505E-4,4.34913034728338E-4,4.3738935877046873E-4,4.3919881273851626E-4,4.403386372014898E-4,4.4080714324052245E-4,4.4060362061153896E-4,4.397282975974511E-4,4.381823539946002E-4,4.359679864211396E-4,4.3308852290143866E-4,4.2954858155748677E-4,4.2535426630813713E-4,4.2051339081429956E-4,4.150357205764127E-4,4.089332221396751E-4,4.0222030782730505E-4,3.9491406432054055E-4,3.870344537371488E-4,0.0027475238471166364,0.0028965024182652766,0.0030406887829419293,0.003178781885079778,0.0033095391591644262,0.003431802515966283,0.0035445230139670263,0.0036467834766398064,0.0037378183693767917,0.0038170303309678385,0.003884002860026987,0.00393850878229685,0.003980514264959872,0.004010178292820951,0.00402784767192542,0.004034047772192321,0.004029469355594602,0.004014951954541941,0.0039914643615782145,0.003960082862622643,0.003921967889443938,0.0038783397819973408,0.0038304543382770887,0.0037795787904444777,0.0037269687844378304,0.0036738468603380457,0.0036213828375024127,0.0035706764073895575,0.0035227421337113824,0.003478496959501292,0.0034387502288206104,0.003404196151317676,0.003375408573913497,0.0033528378775964855,0.0033368097895548074,0.0033275258913322797,0.003325065610905685,0.003329389508077795,0.0033403436950779964,0.003357665273897362,0.0033809887144745985,0.003409853139179136,0.0034437105151345787,0.0034819347833121954,0.003523831969253377,0.0035686513228953332,0.00361559752343603,0.003663843959708494,0.003712547058409281,0.003760861583972645,0.003807956777949381,0.0038530331460958716,0.0038953396420511183,0.003934190941631826,0.0039689844554220656,0.003999216693062429,0.004024498573413716,0.004044569272684355,0.004059308218802153,0.004068744874835185,0.004073066006104909,0.004072620192721606,0.004067919428617413,0.004059637736003823,0.004048606816221108,0.0040358088495611455,0.004022366643156726,0.004009531402993346,0.003998668469538551,0.003991241403147826,0.003988794832951648,0.003992936490075895,0.00400531883269064,0.004027620637585717,0.004061528882980356,0.0041087211833720485,0.0041708489636056835,0.004249521480853564,0.004346290725103645,0.0044626371564216154,0.004599956175835848,0.004759545180801642,0.004942591029597162,0.005150157734347446,0.005383174220970252,0.005642422036032139,0.005928522943565222,0.006241926436067605,0.006582897278513475,0.006951503306338697,0.0073476038012072545,0.007770838864533342,0.008220620290709623,0.008696124502549854,0.009196288144220294,0.009719806926693143,0.01026513828400749,0.010830508323821866,0.011413923443546548,0.01201318683679911,0.012625919939338995,0.01324958866653355,0.01388153408512658,0.014519006951424234,0.015159205347566668,0.01579931446920901,0.016436547472934264,0.017068186190191386,0.01769162046457138,0.018304384876360467,0.01890419168501673,0.01948895894558392,0.020056832934630116,0.02060620424721084,0.02113571718770954,0.021644272360657645,0.02213102265772488,0.022595363117818165,0.023036915392978127,0.02345550776890735,0.023851151853201587,0.024224017147711586,0.024574404758529417,0.024902721467077595,0.02520945529203805,0.025495153522162924,0.025760404005840593,0.026005820259013747,0.026232030715003136,0.026439672205114922,0.026629387543985007,0.026801826913277055,0.026957652603366713,0.027097546592867092,0.027222220423851144,0.027332426864797473,0.027428972937607283,0.027512734008765215,0.02758466879358037,0.0276458352796022,0.027697407722156314,0.027740694983132606,0.02777716055625212,0.02780844463334076,0.02783638850552596,0.027863061454298,0.027890790068922623,0.02792218963325823,0.027960196866909738,0.02800810289871057,0.028069584915482497,0.02814873449104211,0.02825008018763706,0.02837860166486145,0.02853973226055532,0.02873934685458216,0.02898373181777016,0.029279534008860065,0.02963368613077612,0.030053306305706386,0.030545570479487968,0.03111755721311172,0.031776065545269766,0.03252740788566085,0.03337718128336799,0.034330021855643995,0.03538934859704943,0.0365571041458701,0.037833501286693445,0.0392167849353687,0.040703020007144194,0.04228591583904,0.04395669766309752,0.0457040349643067,0.04751403538287408,0.04937031113735827,0.051254122783048604,0.05314460253798383,0.05501905649501162,0.056853341906496095,0.05862231251481291,0.060300321758582,0.0618617707715128,0.06328168556666004,0.06453630581190173,0.0656036662805314,0.06646415150258725,0.06710100441007427,0.06750077088231911,0.06765366403106858,0.06755383474802358,0.06719953835712301,0.06659319102028986,0.06574131365994076,0.06465436538754352,0.06334647256116176,0.061835063437733685,0.06014042175620245,0.05828517533134126,0.056293737737220906,0.05419172233796565,0.05200534825166566,0.04976085732696359,0.04748395993009316,0.04519932538029131,0.04293013036133444,0.04069767572579532,0.03852107895737679,0.03641704632792239,0.03439972563401296,0.032480637461995795,0.0306686803256548,0.028970202835964333,0.0273891343561838,0.025927164396476528,0.024583960310180692,0.02335741264342493,0.022243897714499226,0.021238547597084247,0.020335518579659012,0.019528250294881394,0.018809708980359163,0.01817260967327791,0.017609613490779167,0.01711349745069935,0.016677295499434582,0.016294410502967642,0.015958697902246913,0.015664522523903473,0.015406790668988722,0.01518096008003403,0.014983030719336033,0.014809519491381864,0.014657422124105356,0.014524165402374889,0.014407552837850775,0.014305706676628204,0.014217008903539328,0.014140043612285802,0.014073542785512322,0.014016337179510726,0.013967313644869358,0.013925379846940353,0.013889436987898287,0.013858360784345113,0.0138309906291635,0.013806126571162262,0.013782533487494123,0.013758951607127827,0.013734112372670696,0.013706758504805728,0.013675667059113543,0.013639674238006353,0.013597700738237616,0.013548776472913743,0.013492063600895032,0.01342687691986212,0.013352700825543296,0.013269202201834517,0.013176238778116432,0.013073862664669214,0.012962318948995041,0.012842039400133743,0.012713631480576257,0.01257786300290588,0.01243564288841738,0.012287998586033052,0.012136050790880603,0.01198098616248523,0.011824028782664508,0.011666411113234515,0.011509345214116729,0.011353994964143133,0.01120144999071003,0.011052701961490913,0.010908623822907703,0.010769952487386488,0.010637275376217864,0.010511021118998971,0.010391454596331312,0.0102786763921797,0.010172626598859048,0.010073092794094133,0.00997972188932595,0.009892035434923943,0.009809447864804139,0.00973128707372538,0.009656816648658159,0.009585259024218792,0.009515818803906213,0.009447705485832554,0.00938015485509699,0.009312448355309129,0.009243929828393942,0.009174019112966385,0.00910222211437133,0.009028137099928373,0.008951457125934984,0.008871968662587318,0.00878954664249858,0.00870414631082715,0.008615792392973316,0.008524566212441539,0.008430591480530396,0.00833401953579581,0.008235014830924606,0.008133741445655446,0.00803035134651735,0.007924975019292534,0.007817714972163303,0.0077086424523083235,0.007597797543774042,0.007485192628573831,0.007370819005811525,0.007254656285154372,0.007136684010899955,0.007016894840072843,0.006895308499969602,0.006771985693038716,0.006647041103450641,0.006520654691282208,0.006393080535515737,0.006264652602212202,0.006135786963218254,0.006006980165704355,0.005878803644387756,0.005751894266292814,0.005626941291881473,0.005504670216215964,0.005385824110249099,0.0052711432075347175,0.0051613435695894725,0.00505709570991162,0.0049590040606568445,0.004867588127883346,0.004783266104020258,0.004706341594668781,0.004636993977538607,0.004575272751983367,0.004521096066689508,0.004474253439281699,0.004434412513350575,0.0044011295433798924,0.004373863162825866,0.0043519908803424595,0.00433482766739564,0.004321645949106567,0.004311696289265227,0.004304228068664983,0.004298509490486763,0.004293846303615894,0.004289598709984682,0.0042851960104000495,0.004280148639897137,0.004274057343781891,0.0042666193450325,0.004257631449166554,0.004246990121404463,0.004234688651160292,0.004220811589548967,0.004205526706368366,0.004189074764071212,0.004171757448088697,0.004153923826151732,0.004135955734581608,0.004118252507314122,0.00410121547382234,0.004085232654936603,0.004070664080347914,0.0040578281376207476,0.0040469893390312,0.004038347858742049,0.00403203114821673,0.004028087882251981,0.004026484422021365,0.0040271039061802495,0.004029747998217696,0.004034141230396734,0.00403993779498414,0.004046730545718157,0.004054061890587029,0.004061436185050598,0.004068333176695064,0.004074222011367479,0.004078575289776993,0.004080882664128013,0.004080663487225812,0.004077478071140204,0.004070937177193936,0.004060709440883852,0.004046526530466923,0.00402818594167848,0.004005551438196812,0.003978551252598691,0.003947174260327893,0.003911464424691579,0.0038715138798683926,0.0038274550680551184,0.0037794523740116957,0.0037276937044348835,0.003672382441107972,0.0036137301571671685,0.0035519504277218136,0.0034872539930121604,0.0034198454485160493,0.0033499215465786886,0.0032776711030333503,0.0032032764145703526,0.003126916012578522,0.003048768510509525,0.0029690172474191446,0.0028878553922639756,0.002805491152895283,0.0027221527306973852,0.0026380926758122008,0.0025535913274730973,0.0024689590671247777,0.0023845371662628667,0.0023006970735282625,0.0022178380536461433,0.002136383161429748,0.0020567736045261405,0.0019794616163389396,0.0019049020233769744,0.0018335427472189185,0.0017658145287449308,0.0017021201999753122,0.001642823855774253,0.0015882402930977395,0.001538625088916224,0.0014941656791982118,0.0014549737804224726,0.001421079462283432,0.0013924271361482837,0.0013688736693247552,0.0013501887715736348,0.00133605772920249,0.0013260864855490417,0.0013198089871225872,0.0013166966348660191,0.0013161696029269135,0.0013176097161214802,0.0013203745150786356,0.0013238120878415176,0.0013272762111256995,0.001330141325626023,0.001331816869200495,0.0013317605101153367,0.0013294898595944957,0.001324592297530903,0.001316732615316717,0.0013056582624204026,0.0012912020749482743,0.0012732824608113254,0.0012519011127972634,0.0012271384132821461,0.0011991467781617185,0.001168142258942819,0.0011343947775875798,0.0010982174062845052,0.0010599551224595083,0.0010199734677247751,9.786475188444715E-4,9.36351540920143E-4,8.934496404811425E-4,8.502876723135676E-4,8.071865824546614E-4,7.644372948323629E-4,7.222971745418834E-4,6.809880304756205E-4,6.406955572547638E-4,6.015700638200827E-4,5.637282955467648E-4,5.272561294623279E-4,4.92211908350891E-4,4.586301787237481E-4,4.265256086351844E-4,3.9589688236939925E-4,3.66730397953023E-4,3.3900362784898476E-4,3.12688040577067E-4,2.8775151898462745E-4,2.6416024728066875E-4,2.4188007190490668E-4,2.208773693996701E-4,2.0111947671147838E-4,1.8257475526020278E-4,1.6521236960866597E-4,1.490018649695076E-4,1.3391262574914735E-4,1.1991329074298737E-4,1.0697119050917411E-4,9.505185997542905E-5,8.411866557796138E-5,7.413257221586494E-5,6.505206191702955E-5,5.683320406892184E-5,4.9429866894209646E-5,4.279405187464566E-5,3.6876327186945754E-5,3.162633288424882E-5,2.6993329369915867E-5,2.292676139475339E-5,1.9376812021261398E-5,1.6294924358999862E-5,1.363427299704197E-5,1.1350171575477395E-5,9.400407520243353E-6,7.745499339637641E-6,6.348875833344495E-6,5.176979945729226E-6,4.1993027157747696E-6],\n",
       "\"age\":[0.1667,0.3229295499021526,0.47915909980430527,0.6353886497064578,0.7916181996086105,0.9478477495107631,1.1040772994129158,1.2603068493150684,1.416536399217221,1.5727659491193737,1.7289954990215264,1.885225048923679,2.0414545988258315,2.1976841487279843,2.3539136986301368,2.5101432485322897,2.666372798434442,2.8226023483365945,2.9788318982387474,3.1350614481409,3.2912909980430527,3.447520547945205,3.603750097847358,3.7599796477495104,3.916209197651663,4.072438747553815,4.228668297455968,4.38489784735812,4.541127397260273,4.697356947162426,4.853586497064579,5.009816046966731,5.166045596868884,5.3222751467710365,5.4785046966731885,5.634734246575341,5.790963796477494,5.947193346379647,6.103422896281799,6.259652446183952,6.415881996086105,6.572111545988257,6.72834109589041,6.884570645792563,7.0408001956947155,7.1970297455968675,7.35325929549902,7.509488845401173,7.665718395303325,7.821947945205478,7.978177495107631,8.134407045009784,8.290636594911938,8.44686614481409,8.603095694716242,8.759325244618395,8.915554794520547,9.0717843444227,9.228013894324853,9.384243444227005,9.540472994129159,9.69670254403131,9.852932093933463,10.009161643835617,10.165391193737769,10.32162074363992,10.477850293542074,10.634079843444226,10.790309393346378,10.946538943248532,11.102768493150684,11.258998043052838,11.41522759295499,11.571457142857142,11.727686692759296,11.883916242661448,12.0401457925636,12.196375342465753,12.352604892367905,12.508834442270057,12.665063992172211,12.821293542074363,12.977523091976515,13.133752641878669,13.28998219178082,13.446211741682975,13.602441291585126,13.758670841487278,13.914900391389432,14.071129941291584,14.227359491193736,14.38358904109589,14.539818590998042,14.696048140900194,14.852277690802348,15.0085072407045,15.164736790606652,15.320966340508805,15.477195890410957,15.633425440313111,15.789654990215263,15.945884540117415,16.10211409001957,16.25834363992172,16.414573189823873,16.570802739726023,16.727032289628177,16.88326183953033,17.03949138943248,17.195720939334635,17.35195048923679,17.50818003913894,17.664409589041092,17.820639138943246,17.976868688845396,18.13309823874755,18.289327788649704,18.445557338551858,18.601786888454008,18.75801643835616,18.914245988258315,19.070475538160466,19.22670508806262,19.382934637964773,19.539164187866923,19.695393737769077,19.85162328767123,20.00785283757338,20.164082387475535,20.32031193737769,20.47654148727984,20.632771037181993,20.789000587084146,20.945230136986297,21.10145968688845,21.257689236790604,21.413918786692754,21.570148336594908,21.726377886497062,21.882607436399212,22.038836986301366,22.19506653620352,22.351296086105673,22.507525636007824,22.663755185909977,22.81998473581213,22.97621428571428,23.132443835616435,23.28867338551859,23.44490293542074,23.601132485322893,23.757362035225047,23.913591585127197,24.06982113502935,24.226050684931504,24.382280234833654,24.53850978473581,24.694739334637962,24.850968884540112,25.007198434442266,25.16342798434442,25.31965753424657,25.475887084148724,25.632116634050877,25.788346183953028,25.94457573385518,26.100805283757335,26.25703483365949,26.41326438356164,26.569493933463793,26.725723483365947,26.881953033268097,27.03818258317025,27.194412133072404,27.350641682974555,27.50687123287671,27.663100782778862,27.819330332681012,27.975559882583166,28.13178943248532,28.28801898238747,28.444248532289624,28.600478082191778,28.756707632093928,28.91293718199608,29.069166731898235,29.225396281800386,29.38162583170254,29.537855381604693,29.694084931506843,29.850314481408997,30.00654403131115,30.1627735812133,30.319003131115455,30.47523268101761,30.631462230919762,30.787691780821913,30.943921330724066,31.10015088062622,31.25638043052837,31.412609980430524,31.568839530332678,31.725069080234828,31.881298630136982,32.03752818003914,32.19375772994129,32.34998727984344,32.50621682974559,32.66244637964775,32.8186759295499,32.97490547945205,33.131135029354205,33.287364579256355,33.443594129158505,33.59982367906066,33.75605322896281,33.91228277886496,34.06851232876712,34.22474187866927,34.38097142857142,34.53720097847358,34.69343052837573,34.84966007827788,35.005889628180036,35.162119178082186,35.318348727984336,35.47457827788649,35.630807827788644,35.787037377690794,35.94326692759295,36.0994964774951,36.25572602739726,36.41195557729941,36.56818512720156,36.72441467710372,36.88064422700587,37.03687377690802,37.193103326810174,37.349332876712324,37.505562426614475,37.66179197651663,37.81802152641878,37.97425107632093,38.13048062622309,38.28671017612524,38.44293972602739,38.59916927592955,38.7553988258317,38.91162837573385,39.067857925636005,39.224087475538155,39.380317025440306,39.53654657534246,39.69277612524461,39.84900567514676,40.00523522504892,40.16146477495107,40.31769432485322,40.47392387475538,40.63015342465753,40.78638297455968,40.942612524461836,41.098842074363986,41.25507162426614,41.411301174168294,41.567530724070444,41.723760273972594,41.87998982387475,42.0362193737769,42.19244892367905,42.34867847358121,42.50490802348336,42.66113757338551,42.81736712328767,42.97359667318982,43.12982622309197,43.286055772994125,43.442285322896275,43.598514872798425,43.75474442270058,43.91097397260273,44.06720352250488,44.22343307240704,44.37966262230919,44.53589217221135,44.6921217221135,44.84835127201565,45.004580821917806,45.160810371819956,45.317039921722106,45.47326947162426,45.629499021526414,45.785728571428564,45.94195812133072,46.09818767123287,46.25441722113502,46.41064677103718,46.56687632093933,46.72310587084148,46.87933542074364,47.03556497064579,47.19179452054794,47.348024070450094,47.504253620352245,47.660483170254395,47.81671272015655,47.9729422700587,48.12917181996085,48.28540136986301,48.44163091976516,48.59786046966731,48.75409001956947,48.91031956947162,49.06654911937377,49.222778669275925,49.379008219178075,49.535237769080226,49.69146731898238,49.84769686888453,50.00392641878668,50.16015596868884,50.31638551859099,50.47261506849314,50.6288446183953,50.78507416829745,50.9413037181996,51.097533268101756,51.253762818003906,51.40999236790606,51.566221917808214,51.722451467710364,51.878681017612514,52.03491056751467,52.19114011741682,52.34736966731898,52.50359921722113,52.65982876712328,52.81605831702544,52.97228786692759,53.12851741682974,53.284746966731895,53.440976516634045,53.597206066536195,53.75343561643835,53.9096651663405,54.06589471624265,54.22212426614481,54.37835381604696,54.53458336594911,54.69081291585127,54.84704246575342,55.00327201565557,55.159501565557726,55.315731115459876,55.471960665362026,55.62819021526418,55.784419765166334,55.940649315068484,56.09687886497064,56.25310841487279,56.40933796477494,56.5655675146771,56.72179706457925,56.8780266144814,57.03425616438356,57.19048571428571,57.34671526418786,57.502944814090014,57.659174363992165,57.815403913894315,57.97163346379647,58.12786301369862,58.28409256360077,58.44032211350293,58.59655166340508,58.75278121330723,58.90901076320939,59.06524031311154,59.22146986301369,59.377699412915845,59.533928962817996,59.690158512720146,59.8463880626223,60.00261761252445,60.1588471624266,60.31507671232876,60.47130626223091,60.62753581213307,60.78376536203522,60.93999491193737,61.096224461839526,61.252454011741676,61.40868356164383,61.564913111545984,61.721142661448134,61.877372211350284,62.03360176125244,62.18983131115459,62.34606086105674,62.5022904109589,62.65851996086105,62.8147495107632,62.97097906066536,63.12720861056751,63.28343816046966,63.439667710371815,63.595897260273965,63.752126810176115,63.90835636007827,64.06458590998042,64.22081545988259,64.37704500978474,64.53327455968689,64.68950410958904,64.84573365949119,65.00196320939335,65.1581927592955,65.31442230919765,65.4706518590998,65.62688140900195,65.7831109589041,65.93934050880627,66.09557005870842,66.25179960861057,66.40802915851272,66.56425870841487,66.72048825831702,66.87671780821918,67.03294735812133,67.18917690802348,67.34540645792563,67.50163600782778,67.65786555772993,67.8140951076321,67.97032465753425,68.1265542074364,68.28278375733855,68.4390133072407,68.59524285714285,68.75147240704501,68.90770195694716,69.06393150684931,69.22016105675146,69.37639060665362,69.53262015655577,69.68884970645793,69.84507925636008,70.00130880626223,70.15753835616438,70.31376790606653,70.46999745596868,70.62622700587085,70.782456555773,70.93868610567515,71.0949156555773,71.25114520547945,71.4073747553816,71.56360430528376,71.71983385518591,71.87606340508806,72.03229295499021,72.18852250489236,72.34475205479453,72.50098160469668,72.65721115459883,72.81344070450098,72.96967025440313,73.12589980430528,73.28212935420744,73.43835890410959,73.59458845401174,73.75081800391389,73.90704755381604,74.06327710371819,74.21950665362036,74.37573620352251,74.53196575342466,74.68819530332681,74.84442485322896,75.00065440313111,75.15688395303327,75.31311350293542,75.46934305283757,75.62557260273972,75.78180215264187,75.93803170254402,76.09426125244619,76.25049080234834,76.40672035225049,76.56294990215264,76.71917945205479,76.87540900195694,77.0316385518591,77.18786810176125,77.3440976516634,77.50032720156555,77.6565567514677,77.81278630136985,77.96901585127202,78.12524540117417,78.28147495107632,78.43770450097847,78.59393405088062,78.75016360078277,78.90639315068493,79.06262270058708,79.21885225048923,79.37508180039138,79.53131135029354,79.68754090019569,79.84377045009785,80.0,0.1667,0.3229295499021526,0.47915909980430527,0.6353886497064578,0.7916181996086105,0.9478477495107631,1.1040772994129158,1.2603068493150684,1.416536399217221,1.5727659491193737,1.7289954990215264,1.885225048923679,2.0414545988258315,2.1976841487279843,2.3539136986301368,2.5101432485322897,2.666372798434442,2.8226023483365945,2.9788318982387474,3.1350614481409,3.2912909980430527,3.447520547945205,3.603750097847358,3.7599796477495104,3.916209197651663,4.072438747553815,4.228668297455968,4.38489784735812,4.541127397260273,4.697356947162426,4.853586497064579,5.009816046966731,5.166045596868884,5.3222751467710365,5.4785046966731885,5.634734246575341,5.790963796477494,5.947193346379647,6.103422896281799,6.259652446183952,6.415881996086105,6.572111545988257,6.72834109589041,6.884570645792563,7.0408001956947155,7.1970297455968675,7.35325929549902,7.509488845401173,7.665718395303325,7.821947945205478,7.978177495107631,8.134407045009784,8.290636594911938,8.44686614481409,8.603095694716242,8.759325244618395,8.915554794520547,9.0717843444227,9.228013894324853,9.384243444227005,9.540472994129159,9.69670254403131,9.852932093933463,10.009161643835617,10.165391193737769,10.32162074363992,10.477850293542074,10.634079843444226,10.790309393346378,10.946538943248532,11.102768493150684,11.258998043052838,11.41522759295499,11.571457142857142,11.727686692759296,11.883916242661448,12.0401457925636,12.196375342465753,12.352604892367905,12.508834442270057,12.665063992172211,12.821293542074363,12.977523091976515,13.133752641878669,13.28998219178082,13.446211741682975,13.602441291585126,13.758670841487278,13.914900391389432,14.071129941291584,14.227359491193736,14.38358904109589,14.539818590998042,14.696048140900194,14.852277690802348,15.0085072407045,15.164736790606652,15.320966340508805,15.477195890410957,15.633425440313111,15.789654990215263,15.945884540117415,16.10211409001957,16.25834363992172,16.414573189823873,16.570802739726023,16.727032289628177,16.88326183953033,17.03949138943248,17.195720939334635,17.35195048923679,17.50818003913894,17.664409589041092,17.820639138943246,17.976868688845396,18.13309823874755,18.289327788649704,18.445557338551858,18.601786888454008,18.75801643835616,18.914245988258315,19.070475538160466,19.22670508806262,19.382934637964773,19.539164187866923,19.695393737769077,19.85162328767123,20.00785283757338,20.164082387475535,20.32031193737769,20.47654148727984,20.632771037181993,20.789000587084146,20.945230136986297,21.10145968688845,21.257689236790604,21.413918786692754,21.570148336594908,21.726377886497062,21.882607436399212,22.038836986301366,22.19506653620352,22.351296086105673,22.507525636007824,22.663755185909977,22.81998473581213,22.97621428571428,23.132443835616435,23.28867338551859,23.44490293542074,23.601132485322893,23.757362035225047,23.913591585127197,24.06982113502935,24.226050684931504,24.382280234833654,24.53850978473581,24.694739334637962,24.850968884540112,25.007198434442266,25.16342798434442,25.31965753424657,25.475887084148724,25.632116634050877,25.788346183953028,25.94457573385518,26.100805283757335,26.25703483365949,26.41326438356164,26.569493933463793,26.725723483365947,26.881953033268097,27.03818258317025,27.194412133072404,27.350641682974555,27.50687123287671,27.663100782778862,27.819330332681012,27.975559882583166,28.13178943248532,28.28801898238747,28.444248532289624,28.600478082191778,28.756707632093928,28.91293718199608,29.069166731898235,29.225396281800386,29.38162583170254,29.537855381604693,29.694084931506843,29.850314481408997,30.00654403131115,30.1627735812133,30.319003131115455,30.47523268101761,30.631462230919762,30.787691780821913,30.943921330724066,31.10015088062622,31.25638043052837,31.412609980430524,31.568839530332678,31.725069080234828,31.881298630136982,32.03752818003914,32.19375772994129,32.34998727984344,32.50621682974559,32.66244637964775,32.8186759295499,32.97490547945205,33.131135029354205,33.287364579256355,33.443594129158505,33.59982367906066,33.75605322896281,33.91228277886496,34.06851232876712,34.22474187866927,34.38097142857142,34.53720097847358,34.69343052837573,34.84966007827788,35.005889628180036,35.162119178082186,35.318348727984336,35.47457827788649,35.630807827788644,35.787037377690794,35.94326692759295,36.0994964774951,36.25572602739726,36.41195557729941,36.56818512720156,36.72441467710372,36.88064422700587,37.03687377690802,37.193103326810174,37.349332876712324,37.505562426614475,37.66179197651663,37.81802152641878,37.97425107632093,38.13048062622309,38.28671017612524,38.44293972602739,38.59916927592955,38.7553988258317,38.91162837573385,39.067857925636005,39.224087475538155,39.380317025440306,39.53654657534246,39.69277612524461,39.84900567514676,40.00523522504892,40.16146477495107,40.31769432485322,40.47392387475538,40.63015342465753,40.78638297455968,40.942612524461836,41.098842074363986,41.25507162426614,41.411301174168294,41.567530724070444,41.723760273972594,41.87998982387475,42.0362193737769,42.19244892367905,42.34867847358121,42.50490802348336,42.66113757338551,42.81736712328767,42.97359667318982,43.12982622309197,43.286055772994125,43.442285322896275,43.598514872798425,43.75474442270058,43.91097397260273,44.06720352250488,44.22343307240704,44.37966262230919,44.53589217221135,44.6921217221135,44.84835127201565,45.004580821917806,45.160810371819956,45.317039921722106,45.47326947162426,45.629499021526414,45.785728571428564,45.94195812133072,46.09818767123287,46.25441722113502,46.41064677103718,46.56687632093933,46.72310587084148,46.87933542074364,47.03556497064579,47.19179452054794,47.348024070450094,47.504253620352245,47.660483170254395,47.81671272015655,47.9729422700587,48.12917181996085,48.28540136986301,48.44163091976516,48.59786046966731,48.75409001956947,48.91031956947162,49.06654911937377,49.222778669275925,49.379008219178075,49.535237769080226,49.69146731898238,49.84769686888453,50.00392641878668,50.16015596868884,50.31638551859099,50.47261506849314,50.6288446183953,50.78507416829745,50.9413037181996,51.097533268101756,51.253762818003906,51.40999236790606,51.566221917808214,51.722451467710364,51.878681017612514,52.03491056751467,52.19114011741682,52.34736966731898,52.50359921722113,52.65982876712328,52.81605831702544,52.97228786692759,53.12851741682974,53.284746966731895,53.440976516634045,53.597206066536195,53.75343561643835,53.9096651663405,54.06589471624265,54.22212426614481,54.37835381604696,54.53458336594911,54.69081291585127,54.84704246575342,55.00327201565557,55.159501565557726,55.315731115459876,55.471960665362026,55.62819021526418,55.784419765166334,55.940649315068484,56.09687886497064,56.25310841487279,56.40933796477494,56.5655675146771,56.72179706457925,56.8780266144814,57.03425616438356,57.19048571428571,57.34671526418786,57.502944814090014,57.659174363992165,57.815403913894315,57.97163346379647,58.12786301369862,58.28409256360077,58.44032211350293,58.59655166340508,58.75278121330723,58.90901076320939,59.06524031311154,59.22146986301369,59.377699412915845,59.533928962817996,59.690158512720146,59.8463880626223,60.00261761252445,60.1588471624266,60.31507671232876,60.47130626223091,60.62753581213307,60.78376536203522,60.93999491193737,61.096224461839526,61.252454011741676,61.40868356164383,61.564913111545984,61.721142661448134,61.877372211350284,62.03360176125244,62.18983131115459,62.34606086105674,62.5022904109589,62.65851996086105,62.8147495107632,62.97097906066536,63.12720861056751,63.28343816046966,63.439667710371815,63.595897260273965,63.752126810176115,63.90835636007827,64.06458590998042,64.22081545988259,64.37704500978474,64.53327455968689,64.68950410958904,64.84573365949119,65.00196320939335,65.1581927592955,65.31442230919765,65.4706518590998,65.62688140900195,65.7831109589041,65.93934050880627,66.09557005870842,66.25179960861057,66.40802915851272,66.56425870841487,66.72048825831702,66.87671780821918,67.03294735812133,67.18917690802348,67.34540645792563,67.50163600782778,67.65786555772993,67.8140951076321,67.97032465753425,68.1265542074364,68.28278375733855,68.4390133072407,68.59524285714285,68.75147240704501,68.90770195694716,69.06393150684931,69.22016105675146,69.37639060665362,69.53262015655577,69.68884970645793,69.84507925636008,70.00130880626223,70.15753835616438,70.31376790606653,70.46999745596868,70.62622700587085,70.782456555773,70.93868610567515,71.0949156555773,71.25114520547945,71.4073747553816,71.56360430528376,71.71983385518591,71.87606340508806,72.03229295499021,72.18852250489236,72.34475205479453,72.50098160469668,72.65721115459883,72.81344070450098,72.96967025440313,73.12589980430528,73.28212935420744,73.43835890410959,73.59458845401174,73.75081800391389,73.90704755381604,74.06327710371819,74.21950665362036,74.37573620352251,74.53196575342466,74.68819530332681,74.84442485322896,75.00065440313111,75.15688395303327,75.31311350293542,75.46934305283757,75.62557260273972,75.78180215264187,75.93803170254402,76.09426125244619,76.25049080234834,76.40672035225049,76.56294990215264,76.71917945205479,76.87540900195694,77.0316385518591,77.18786810176125,77.3440976516634,77.50032720156555,77.6565567514677,77.81278630136985,77.96901585127202,78.12524540117417,78.28147495107632,78.43770450097847,78.59393405088062,78.75016360078277,78.90639315068493,79.06262270058708,79.21885225048923,79.37508180039138,79.53131135029354,79.68754090019569,79.84377045009785,80.0]\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"e0DgX7\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "// Density plot\n",
    "plot +\n",
    "    geomDensity { x=\"age\"; color=\"survived\" } +\n",
    "    scaleColorManual(listOf(colors[\"dark_grey\"]!!, colors[\"orange\"]!!)) +\n",
    "    ggsize(850, 250)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"KdOTnq\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"data\":{\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":500.0,\n",
       "\"height\":400.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"values\":[\"#4c4c4c\",\"#ff6632\"]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"survived\",\n",
       "\"y\":\"age\",\n",
       "\"fill\":\"survived\"\n",
       "},\n",
       "\"stat\":\"boxplot\",\n",
       "\"position\":{\n",
       "\"name\":\"dodge\",\n",
       "\"width\":0.95,\n",
       "\"kind\":\"pos\"\n",
       "},\n",
       "\"geom\":\"boxplot\",\n",
       "\"data\":{\n",
       "\"..middle..\":[NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,29.8811345124283,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,29.8811345124283],\n",
       "\"..upper..\":[NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,36.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,35.0],\n",
       "\"..ymax..\":[NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,56.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,52.0],\n",
       "\"..lower..\":[NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,21.5,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,23.0],\n",
       "\"..ymin..\":[NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.1667,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,5.0],\n",
       "\"survived\":[\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Survived\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\",\"Died\"],\n",
       "\"age\":[58.0,58.0,58.0,58.0,59.0,60.0,60.0,60.0,60.0,62.0,62.0,63.0,63.0,64.0,64.0,76.0,80.0,NaN,0.3333,0.75,1.0,1.0,1.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,3.0,3.0,4.0,4.0,4.0,54.0,54.0,54.0,54.0,54.0,55.0,55.0,55.0,55.0,55.5,56.0,56.0,57.0,57.0,57.0,57.0,57.0,58.0,58.0,59.0,59.0,60.0,60.0,60.0,60.5,61.0,61.0,61.0,61.0,61.0,62.0,62.0,62.0,63.0,63.0,64.0,64.0,64.0,65.0,65.0,65.0,66.0,67.0,70.0,70.0,70.5,71.0,71.0,74.0,NaN]\n",
       "}\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"KdOTnq\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "// A basic box plot\n",
    "plot +\n",
    "    geomBoxplot { x=\"survived\"; y=\"age\"; fill = \"survived\" } +\n",
    "    scaleFillManual(listOf(colors[\"dark_grey\"]!!, colors[\"orange\"]!!)) +\n",
    "    ggsize(500, 400)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Seems like we have the same age distribution among survived and not survived passengers."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Categorical features with One Hot Encoding\n",
    "\n",
    "To prepare data for the ML algorithms, we should replace all String values in categorical features on numbers. There are a few ways of how to preprocess categorical features, and One Hot Encoding is one of them. We will use [`pivotMatches`](https://kotlin.github.io/dataframe/pivot.html#pivotmatches) operation to convert categorical columns into sets of nested `Boolean` columns per every unique value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410163\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 14</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"name: String\\\">name</span>\", children: [], rightAlign: false, values: [\"Allen, Miss. Elisabeth Walton\",\"Allison, Master. Hudson Trevor\",\"Allison, Miss. Helen Loraine\",\"Allison, Mr. Hudson Joshua Creighton\",\"<span class=\\\"formatted\\\" title=\\\"Allison, Mrs. Hudson J C (Bessie Waldo Daniels)\\\">Allison, Mrs. Hudson J C (Bessie Wald<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">29.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.9167</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">30.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">25.0000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sibsp: Double\\\">sibsp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"parch: Double\\\">parch</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"ticket: String\\\">ticket</span>\", children: [], rightAlign: false, values: [\"24160\",\"113781\",\"113781\",\"113781\",\"113781\"] }, \n",
       "{ name: \"<span title=\\\"fare: Double\\\">fare</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">211.3375</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"cabin: String\\\">cabin</span>\", children: [], rightAlign: false, values: [\"B5\",\"C22 C26\",\"C22 C26\",\"C22 C26\",\"C22 C26\"] }, \n",
       "{ name: \"<span title=\\\"boat: String?\\\">boat</span>\", children: [], rightAlign: false, values: [\"2\",\"11\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"body: Int?\\\">body</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">135</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"homedest: String\\\">homedest</span>\", children: [], rightAlign: false, values: [\"St Louis, MO\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\"] }, \n",
       "{ name: \"<span title=\\\"1: Boolean\\\">1</span>\", children: [], rightAlign: false, values: [\"true\",\"true\",\"true\",\"true\",\"true\"] }, \n",
       "{ name: \"<span title=\\\"2: Boolean\\\">2</span>\", children: [], rightAlign: false, values: [\"false\",\"false\",\"false\",\"false\",\"false\"] }, \n",
       "{ name: \"<span title=\\\"3: Boolean\\\">3</span>\", children: [], rightAlign: false, values: [\"false\",\"false\",\"false\",\"false\",\"false\"] }, \n",
       "{ name: \"<span title=\\\"pclass: DataRow\\\">pclass</span>\", children: [11, 12, 13], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"1: true\\n2: false\\n3: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span>false<span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: true\\n2: false\\n3: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span>false<span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: true\\n2: false\\n3: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span>false<span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: true\\n2: false\\n3: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span>false<span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: true\\n2: false\\n3: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span>false<span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"female: Boolean\\\">female</span>\", children: [], rightAlign: false, values: [\"true\",\"false\",\"true\",\"false\",\"true\"] }, \n",
       "{ name: \"<span title=\\\"male: Boolean\\\">male</span>\", children: [], rightAlign: false, values: [\"false\",\"true\",\"false\",\"true\",\"false\"] }, \n",
       "{ name: \"<span title=\\\"sex: DataRow\\\">sex</span>\", children: [15, 16], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"female: true\\nmale: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span>false<span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"female: false\\nmale: true\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span>true<span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"female: true\\nmale: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span>false<span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"female: false\\nmale: true\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span>true<span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"female: true\\nmale: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span>false<span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"S: Boolean\\\">S</span>\", children: [], rightAlign: false, values: [\"true\",\"false\",\"true\",\"true\",\"true\"] }, \n",
       "{ name: \"<span title=\\\"AA: Boolean\\\">AA</span>\", children: [], rightAlign: false, values: [\"false\",\"true\",\"false\",\"false\",\"false\"] }, \n",
       "{ name: \"<span title=\\\"C: Boolean\\\">C</span>\", children: [], rightAlign: false, values: [\"false\",\"false\",\"false\",\"false\",\"false\"] }, \n",
       "{ name: \"<span title=\\\"Q: Boolean\\\">Q</span>\", children: [], rightAlign: false, values: [\"false\",\"false\",\"false\",\"false\",\"false\"] }, \n",
       "{ name: \"<span title=\\\"embarked: DataRow\\\">embarked</span>\", children: [18, 19, 20, 21], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"S: true\\nAA: false\\nC: false\\nQ: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"S: false\\nAA: true\\nC: false\\nQ: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"S: true\\nAA: false\\nC: false\\nQ: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"S: true\\nAA: false\\nC: false\\nQ: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"S: true\\nAA: false\\nC: false\\nQ: false\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span>true<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span>false<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "], id: -1023410163, rootId: -1023410163, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410163) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val pivoted = df1.pivotMatches { pclass and sex and embarked }\n",
    "pivoted.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410162\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 8</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"1: Double\\\">1</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"2: Double\\\">2</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"3: Double\\\">3</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"pclass: DataRow\\\">pclass</span>\", children: [1, 2, 3], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"1: 1.0\\n2: 0.0\\n3: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 1.0\\n2: 0.0\\n3: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 1.0\\n2: 0.0\\n3: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 1.0\\n2: 0.0\\n3: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"1: 1.0\\n2: 0.0\\n3: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">1: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">2: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">3: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sibsp: Double\\\">sibsp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"parch: Double\\\">parch</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">29.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.9167</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">30.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">25.0000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"fare: Double\\\">fare</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">211.3375</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"female: Double\\\">female</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"male: Double\\\">male</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sex: DataRow\\\">sex</span>\", children: [9, 10], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"female: 1.0\\nmale: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"female: 0.0\\nmale: 1.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"female: 1.0\\nmale: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"female: 0.0\\nmale: 1.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"female: 1.0\\nmale: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">female: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">male: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"S: Double\\\">S</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"AA: Double\\\">AA</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"C: Double\\\">C</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Q: Double\\\">Q</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"embarked: DataRow\\\">embarked</span>\", children: [12, 13, 14, 15], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"S: 1.0\\nAA: 0.0\\nC: 0.0\\nQ: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"S: 0.0\\nAA: 1.0\\nC: 0.0\\nQ: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"S: 1.0\\nAA: 0.0\\nC: 0.0\\nQ: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"S: 1.0\\nAA: 0.0\\nC: 0.0\\nQ: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"S: 1.0\\nAA: 0.0\\nC: 0.0\\nQ: 0.0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">S: </span><span class=\\\"numbers\\\">1.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">AA: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">C: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Q: </span><span class=\\\"numbers\\\">0.0</span><span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "], id: -1023410162, rootId: -1023410162, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410162) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val df2 = pivoted\n",
    "            // feature extraction\n",
    "            .select{ survived and pclass and sibsp and parch and age and fare and sex and embarked}\n",
    "            .convert { allDfs() }.toDouble()\n",
    "\n",
    "df2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"BsaEzH\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"kind\":\"ggbunch\",\n",
       "\"items\":[{\n",
       "\"x\":0,\n",
       "\"width\":672,\n",
       "\"y\":0,\n",
       "\"feature_spec\":{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"Tiles\"\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"xlim\":[-0.6,13.6],\n",
       "\"flip\":false,\n",
       "\"ylim\":[-0.6,13.6]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":675.0,\n",
       "\"height\":602.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"color\",\n",
       "\"scale_mapper_kind\":\"color_gradient2\",\n",
       "\"high\":\"#4c4c4c\",\n",
       "\"na_value\":\"rgba(0,0,0,0)\",\n",
       "\"breaks\":[-1.0,-0.5,0.0,0.5,1.0],\n",
       "\"low\":\"#ff6632\",\n",
       "\"name\":\"\",\n",
       "\"mid\":\"#a6a6a6\",\n",
       "\"midpoint\":0.0,\n",
       "\"limits\":[-1.0,1.0],\n",
       "\"labels\":[\"-1\",\"-0.5\",\"0\",\"0.5\",\"1\"]\n",
       "},{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_gradient2\",\n",
       "\"high\":\"#4c4c4c\",\n",
       "\"na_value\":\"rgba(0,0,0,0)\",\n",
       "\"breaks\":[-1.0,-0.5,0.0,0.5,1.0],\n",
       "\"low\":\"#ff6632\",\n",
       "\"name\":\"\",\n",
       "\"mid\":\"#a6a6a6\",\n",
       "\"midpoint\":0.0,\n",
       "\"limits\":[-1.0,1.0],\n",
       "\"labels\":[\"-1\",\"-0.5\",\"0\",\"0.5\",\"1\"]\n",
       "},{\n",
       "\"aesthetic\":\"size\",\n",
       "\"scale_mapper_kind\":\"identity\",\n",
       "\"na_value\":0,\n",
       "\"guide\":\"none\"\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"expand\":[0.0,0.0],\n",
       "\"breaks\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"limits\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"]\n",
       "},{\n",
       "\"aesthetic\":\"y\",\n",
       "\"expand\":[0.0,0.0],\n",
       "\"breaks\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"limits\":[\"Q\",\"C\",\"AA\",\"S\",\"male\",\"female\",\"fare\",\"age\",\"parch\",\"sibsp\",\"3\",\"2\",\"1\",\"survived\"]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\",\n",
       "\"fill\":\"corr\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"data\":{\n",
       "\"corr\":[1.0,0.27944860849992426,0.05079003218350772,-0.28342764376126967,-0.02782511923058273,0.0826595703861011,-0.050198983636982906,0.24420775279437662,0.5286930913890007,-0.5286930913890007,-0.15255107966827613,0.0351710542648909,0.18212335757077264,-0.016071471622351695,0.27944860849992426,1.0,-0.29652604123443427,-0.6221717617743461,-0.0342564132589007,-0.013032696181890471,0.3625867211172813,0.5999558397018141,0.10737066078332866,-0.10737066078332866,-0.1845781686259378,0.04830958695595969,0.325721727907434,-0.16610116149739798,0.05079003218350772,-0.29652604123443427,1.0,-0.5631803952755421,-0.0524185034902581,-0.010056955947491591,-0.01419296407263738,-0.12137196320378947,0.028862225069198062,-0.028862225069198062,0.19725276095184807,-0.014325050573724843,-0.1346754779148611,-0.12197314546876163,-0.28342764376126967,-0.6221717617743461,-0.5631803952755421,1.0,0.07261034363244134,0.019520705339831707,-0.30209303317097,-0.4196164675458202,-0.11656211432894706,0.11656211432894706,-0.0019917608973461735,-0.030056860826983556,-0.17143020241436083,0.2437062066638381,-0.02782511923058273,-0.0342564132589007,-0.0524185034902581,0.07261034363244134,1.0,0.3735871906264913,-0.19074715633383899,0.16022419622116035,0.10960903940948481,-0.10960903940948481,0.07285446185534299,0.013307637299887638,-0.048395989396186403,-0.048677676138907645,0.0826595703861011,-0.013032696181890471,-0.010056955947491591,0.019520705339831707,0.3735871906264913,1.0,-0.1308719630307398,0.2215218879995723,0.21312546120677686,-0.21312546120677686,0.06872024488101977,0.051609553205959405,-0.008635134216455072,-0.10094330002741614,-0.050198983636982906,0.3625867211172813,-0.01419296407263738,-0.30209303317097,-0.19074715633383899,-0.1308719630307398,1.0,0.17152056539956614,-0.05739773844904638,0.05739773844904638,-0.055363527784059154,-0.06218754561145524,0.07617899650119048,-0.012718073865078288,0.24420775279437662,0.5999558397018141,-0.12137196320378947,-0.4196164675458202,0.16022419622116035,0.2215218879995723,0.17152056539956614,1.0,0.18548377352712725,-0.18548377352712725,-0.17357921707909613,0.06322121186468962,0.2862407379004398,-0.13005412554062912,0.5286930913890007,0.10737066078332866,0.028862225069198062,-0.11656211432894706,0.10960903940948481,0.21312546120677686,-0.05739773844904638,0.18548377352712725,1.0,-1.0,-0.1138717060191541,-0.020557736683406817,0.06656361717114193,0.08865120931540156,-0.5286930913890007,-0.10737066078332866,-0.028862225069198062,0.11656211432894706,-0.10960903940948481,-0.21312546120677686,0.05739773844904638,-0.18548377352712725,-1.0,1.0,0.1138717060191541,0.020557736683406817,-0.06656361717114193,-0.08865120931540156,-0.15255107966827613,-0.1845781686259378,0.19725276095184807,-0.0019917608973461735,0.07285446185534299,0.06872024488101977,-0.055363527784059154,-0.17357921707909613,-0.1138717060191541,0.1138717060191541,1.0,-0.042136510218699644,-0.7768488808571018,-0.49076394325052203,0.0351710542648909,0.04830958695595969,-0.014325050573724843,-0.030056860826983556,0.013307637299887638,0.051609553205959405,-0.06218754561145524,0.06322121186468962,-0.020557736683406817,0.020557736683406817,-0.042136510218699644,1.0,-0.014095167341867058,-0.008904434409222697,0.18212335757077264,0.325721727907434,-0.1346754779148611,-0.17143020241436083,-0.048395989396186403,-0.008635134216455072,0.07617899650119048,0.2862407379004398,0.06656361717114193,-0.06656361717114193,-0.7768488808571018,-0.014095167341867058,1.0,-0.16416641695212653,-0.016071471622351695,-0.16610116149739798,-0.12197314546876163,0.2437062066638381,-0.048677676138907645,-0.10094330002741614,-0.012718073865078288,-0.13005412554062912,0.08865120931540156,-0.08865120931540156,-0.49076394325052203,-0.008904434409222697,-0.16416641695212653,1.0],\n",
       "\"x\":[\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\"],\n",
       "\"y\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"]\n",
       "},\n",
       "\"size\":0.0,\n",
       "\"sampling\":\"none\",\n",
       "\"width\":1.002,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"tile\",\n",
       "\"tooltips\":{\n",
       "\"tooltip_lines\":[\"@corr\"],\n",
       "\"tooltip_formats\":[{\n",
       "\"field\":\"@corr\",\n",
       "\"format\":\".2f\"\n",
       "}]\n",
       "},\n",
       "\"height\":1.002\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis_title\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_ticks_x\":{\n",
       "\"blank\":false\n",
       "},\n",
       "\"panel_grid\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_ticks_y\":{\n",
       "\"blank\":false\n",
       "}\n",
       "}\n",
       "},\n",
       "\"height\":600\n",
       "},{\n",
       "\"x\":0,\n",
       "\"width\":672,\n",
       "\"y\":650,\n",
       "\"feature_spec\":{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"Points\"\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"fixed\",\n",
       "\"xlim\":[-0.6,13.6],\n",
       "\"flip\":false,\n",
       "\"ylim\":[-0.6,13.6]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":675.0,\n",
       "\"height\":602.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"color\",\n",
       "\"scale_mapper_kind\":\"color_gradient2\",\n",
       "\"high\":\"#4c4c4c\",\n",
       "\"na_value\":\"rgba(0,0,0,0)\",\n",
       "\"breaks\":[-1.0,-0.5,0.0,0.5,1.0],\n",
       "\"low\":\"#ff6632\",\n",
       "\"name\":\"\",\n",
       "\"mid\":\"#a6a6a6\",\n",
       "\"midpoint\":0.0,\n",
       "\"limits\":[-1.0,1.0],\n",
       "\"labels\":[\"-1\",\"-0.5\",\"0\",\"0.5\",\"1\"]\n",
       "},{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_gradient2\",\n",
       "\"high\":\"#4c4c4c\",\n",
       "\"na_value\":\"rgba(0,0,0,0)\",\n",
       "\"breaks\":[-1.0,-0.5,0.0,0.5,1.0],\n",
       "\"low\":\"#ff6632\",\n",
       "\"name\":\"\",\n",
       "\"mid\":\"#a6a6a6\",\n",
       "\"midpoint\":0.0,\n",
       "\"limits\":[-1.0,1.0],\n",
       "\"labels\":[\"-1\",\"-0.5\",\"0\",\"0.5\",\"1\"]\n",
       "},{\n",
       "\"aesthetic\":\"size\",\n",
       "\"scale_mapper_kind\":\"identity\",\n",
       "\"na_value\":0,\n",
       "\"guide\":\"none\"\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"expand\":[0.0,0.0],\n",
       "\"breaks\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"limits\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"]\n",
       "},{\n",
       "\"aesthetic\":\"y\",\n",
       "\"expand\":[0.0,0.0],\n",
       "\"breaks\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"limits\":[\"Q\",\"C\",\"AA\",\"S\",\"male\",\"female\",\"fare\",\"age\",\"parch\",\"sibsp\",\"3\",\"2\",\"1\",\"survived\"]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\",\n",
       "\"color\":\"corr\",\n",
       "\"size\":\"corr_abs\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"data\":{\n",
       "\"corr\":[1.0,0.27944860849992426,0.05079003218350772,-0.28342764376126967,-0.02782511923058273,0.0826595703861011,-0.050198983636982906,0.24420775279437662,0.5286930913890007,-0.5286930913890007,-0.15255107966827613,0.0351710542648909,0.18212335757077264,-0.016071471622351695,0.27944860849992426,1.0,-0.29652604123443427,-0.6221717617743461,-0.0342564132589007,-0.013032696181890471,0.3625867211172813,0.5999558397018141,0.10737066078332866,-0.10737066078332866,-0.1845781686259378,0.04830958695595969,0.325721727907434,-0.16610116149739798,0.05079003218350772,-0.29652604123443427,1.0,-0.5631803952755421,-0.0524185034902581,-0.010056955947491591,-0.01419296407263738,-0.12137196320378947,0.028862225069198062,-0.028862225069198062,0.19725276095184807,-0.014325050573724843,-0.1346754779148611,-0.12197314546876163,-0.28342764376126967,-0.6221717617743461,-0.5631803952755421,1.0,0.07261034363244134,0.019520705339831707,-0.30209303317097,-0.4196164675458202,-0.11656211432894706,0.11656211432894706,-0.0019917608973461735,-0.030056860826983556,-0.17143020241436083,0.2437062066638381,-0.02782511923058273,-0.0342564132589007,-0.0524185034902581,0.07261034363244134,1.0,0.3735871906264913,-0.19074715633383899,0.16022419622116035,0.10960903940948481,-0.10960903940948481,0.07285446185534299,0.013307637299887638,-0.048395989396186403,-0.048677676138907645,0.0826595703861011,-0.013032696181890471,-0.010056955947491591,0.019520705339831707,0.3735871906264913,1.0,-0.1308719630307398,0.2215218879995723,0.21312546120677686,-0.21312546120677686,0.06872024488101977,0.051609553205959405,-0.008635134216455072,-0.10094330002741614,-0.050198983636982906,0.3625867211172813,-0.01419296407263738,-0.30209303317097,-0.19074715633383899,-0.1308719630307398,1.0,0.17152056539956614,-0.05739773844904638,0.05739773844904638,-0.055363527784059154,-0.06218754561145524,0.07617899650119048,-0.012718073865078288,0.24420775279437662,0.5999558397018141,-0.12137196320378947,-0.4196164675458202,0.16022419622116035,0.2215218879995723,0.17152056539956614,1.0,0.18548377352712725,-0.18548377352712725,-0.17357921707909613,0.06322121186468962,0.2862407379004398,-0.13005412554062912,0.5286930913890007,0.10737066078332866,0.028862225069198062,-0.11656211432894706,0.10960903940948481,0.21312546120677686,-0.05739773844904638,0.18548377352712725,1.0,-1.0,-0.1138717060191541,-0.020557736683406817,0.06656361717114193,0.08865120931540156,-0.5286930913890007,-0.10737066078332866,-0.028862225069198062,0.11656211432894706,-0.10960903940948481,-0.21312546120677686,0.05739773844904638,-0.18548377352712725,-1.0,1.0,0.1138717060191541,0.020557736683406817,-0.06656361717114193,-0.08865120931540156,-0.15255107966827613,-0.1845781686259378,0.19725276095184807,-0.0019917608973461735,0.07285446185534299,0.06872024488101977,-0.055363527784059154,-0.17357921707909613,-0.1138717060191541,0.1138717060191541,1.0,-0.042136510218699644,-0.7768488808571018,-0.49076394325052203,0.0351710542648909,0.04830958695595969,-0.014325050573724843,-0.030056860826983556,0.013307637299887638,0.051609553205959405,-0.06218754561145524,0.06322121186468962,-0.020557736683406817,0.020557736683406817,-0.042136510218699644,1.0,-0.014095167341867058,-0.008904434409222697,0.18212335757077264,0.325721727907434,-0.1346754779148611,-0.17143020241436083,-0.048395989396186403,-0.008635134216455072,0.07617899650119048,0.2862407379004398,0.06656361717114193,-0.06656361717114193,-0.7768488808571018,-0.014095167341867058,1.0,-0.16416641695212653,-0.016071471622351695,-0.16610116149739798,-0.12197314546876163,0.2437062066638381,-0.048677676138907645,-0.10094330002741614,-0.012718073865078288,-0.13005412554062912,0.08865120931540156,-0.08865120931540156,-0.49076394325052203,-0.008904434409222697,-0.16416641695212653,1.0],\n",
       "\"x\":[\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\"],\n",
       "\"y\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"corr_abs\":[1.0,0.27944860849992426,0.05079003218350772,0.28342764376126967,0.02782511923058273,0.0826595703861011,0.050198983636982906,0.24420775279437662,0.5286930913890007,0.5286930913890007,0.15255107966827613,0.0351710542648909,0.18212335757077264,0.016071471622351695,0.27944860849992426,1.0,0.29652604123443427,0.6221717617743461,0.0342564132589007,0.013032696181890471,0.3625867211172813,0.5999558397018141,0.10737066078332866,0.10737066078332866,0.1845781686259378,0.04830958695595969,0.325721727907434,0.16610116149739798,0.05079003218350772,0.29652604123443427,1.0,0.5631803952755421,0.0524185034902581,0.010056955947491591,0.01419296407263738,0.12137196320378947,0.028862225069198062,0.028862225069198062,0.19725276095184807,0.014325050573724843,0.1346754779148611,0.12197314546876163,0.28342764376126967,0.6221717617743461,0.5631803952755421,1.0,0.07261034363244134,0.019520705339831707,0.30209303317097,0.4196164675458202,0.11656211432894706,0.11656211432894706,0.0019917608973461735,0.030056860826983556,0.17143020241436083,0.2437062066638381,0.02782511923058273,0.0342564132589007,0.0524185034902581,0.07261034363244134,1.0,0.3735871906264913,0.19074715633383899,0.16022419622116035,0.10960903940948481,0.10960903940948481,0.07285446185534299,0.013307637299887638,0.048395989396186403,0.048677676138907645,0.0826595703861011,0.013032696181890471,0.010056955947491591,0.019520705339831707,0.3735871906264913,1.0,0.1308719630307398,0.2215218879995723,0.21312546120677686,0.21312546120677686,0.06872024488101977,0.051609553205959405,0.008635134216455072,0.10094330002741614,0.050198983636982906,0.3625867211172813,0.01419296407263738,0.30209303317097,0.19074715633383899,0.1308719630307398,1.0,0.17152056539956614,0.05739773844904638,0.05739773844904638,0.055363527784059154,0.06218754561145524,0.07617899650119048,0.012718073865078288,0.24420775279437662,0.5999558397018141,0.12137196320378947,0.4196164675458202,0.16022419622116035,0.2215218879995723,0.17152056539956614,1.0,0.18548377352712725,0.18548377352712725,0.17357921707909613,0.06322121186468962,0.2862407379004398,0.13005412554062912,0.5286930913890007,0.10737066078332866,0.028862225069198062,0.11656211432894706,0.10960903940948481,0.21312546120677686,0.05739773844904638,0.18548377352712725,1.0,1.0,0.1138717060191541,0.020557736683406817,0.06656361717114193,0.08865120931540156,0.5286930913890007,0.10737066078332866,0.028862225069198062,0.11656211432894706,0.10960903940948481,0.21312546120677686,0.05739773844904638,0.18548377352712725,1.0,1.0,0.1138717060191541,0.020557736683406817,0.06656361717114193,0.08865120931540156,0.15255107966827613,0.1845781686259378,0.19725276095184807,0.0019917608973461735,0.07285446185534299,0.06872024488101977,0.055363527784059154,0.17357921707909613,0.1138717060191541,0.1138717060191541,1.0,0.042136510218699644,0.7768488808571018,0.49076394325052203,0.0351710542648909,0.04830958695595969,0.014325050573724843,0.030056860826983556,0.013307637299887638,0.051609553205959405,0.06218754561145524,0.06322121186468962,0.020557736683406817,0.020557736683406817,0.042136510218699644,1.0,0.014095167341867058,0.008904434409222697,0.18212335757077264,0.325721727907434,0.1346754779148611,0.17143020241436083,0.048395989396186403,0.008635134216455072,0.07617899650119048,0.2862407379004398,0.06656361717114193,0.06656361717114193,0.7768488808571018,0.014095167341867058,1.0,0.16416641695212653,0.016071471622351695,0.16610116149739798,0.12197314546876163,0.2437062066638381,0.048677676138907645,0.10094330002741614,0.012718073865078288,0.13005412554062912,0.08865120931540156,0.08865120931540156,0.49076394325052203,0.008904434409222697,0.16416641695212653,1.0]\n",
       "},\n",
       "\"sampling\":\"none\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"tooltips\":{\n",
       "\"tooltip_lines\":[\"@corr\"],\n",
       "\"tooltip_formats\":[{\n",
       "\"field\":\"@corr\",\n",
       "\"format\":\".2f\"\n",
       "}]\n",
       "},\n",
       "\"size_unit\":\"x\"\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis_title\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_ticks_x\":{\n",
       "\"blank\":false\n",
       "},\n",
       "\"panel_grid\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_ticks_y\":{\n",
       "\"blank\":false\n",
       "}\n",
       "}\n",
       "},\n",
       "\"height\":600\n",
       "},{\n",
       "\"x\":0,\n",
       "\"width\":672,\n",
       "\"y\":1300,\n",
       "\"feature_spec\":{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"Tiles and labels\"\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"fixed\",\n",
       "\"xlim\":[-0.6,13.6],\n",
       "\"flip\":false,\n",
       "\"ylim\":[-0.6,13.6]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":675.0,\n",
       "\"height\":602.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"color\",\n",
       "\"scale_mapper_kind\":\"color_gradient2\",\n",
       "\"high\":\"#4c4c4c\",\n",
       "\"na_value\":\"rgba(0,0,0,0)\",\n",
       "\"breaks\":[-1.0,-0.5,0.0,0.5,1.0],\n",
       "\"low\":\"#ff6632\",\n",
       "\"name\":\"\",\n",
       "\"mid\":\"#a6a6a6\",\n",
       "\"midpoint\":0.0,\n",
       "\"limits\":[-1.0,1.0],\n",
       "\"labels\":[\"-1\",\"-0.5\",\"0\",\"0.5\",\"1\"]\n",
       "},{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_gradient2\",\n",
       "\"high\":\"#4c4c4c\",\n",
       "\"na_value\":\"rgba(0,0,0,0)\",\n",
       "\"breaks\":[-1.0,-0.5,0.0,0.5,1.0],\n",
       "\"low\":\"#ff6632\",\n",
       "\"name\":\"\",\n",
       "\"mid\":\"#a6a6a6\",\n",
       "\"midpoint\":0.0,\n",
       "\"limits\":[-1.0,1.0],\n",
       "\"labels\":[\"-1\",\"-0.5\",\"0\",\"0.5\",\"1\"]\n",
       "},{\n",
       "\"aesthetic\":\"size\",\n",
       "\"scale_mapper_kind\":\"identity\",\n",
       "\"na_value\":0,\n",
       "\"guide\":\"none\"\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"expand\":[0.0,0.0],\n",
       "\"breaks\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"limits\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"]\n",
       "},{\n",
       "\"aesthetic\":\"y\",\n",
       "\"expand\":[0.0,0.0],\n",
       "\"breaks\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"limits\":[\"Q\",\"C\",\"AA\",\"S\",\"male\",\"female\",\"fare\",\"age\",\"parch\",\"sibsp\",\"3\",\"2\",\"1\",\"survived\"]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\",\n",
       "\"fill\":\"corr\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"data\":{\n",
       "\"corr\":[0.27944860849992426,0.05079003218350772,-0.28342764376126967,-0.02782511923058273,0.0826595703861011,-0.050198983636982906,0.24420775279437662,0.5286930913890007,-0.5286930913890007,-0.15255107966827613,0.0351710542648909,0.18212335757077264,-0.016071471622351695,-0.29652604123443427,-0.6221717617743461,-0.0342564132589007,-0.013032696181890471,0.3625867211172813,0.5999558397018141,0.10737066078332866,-0.10737066078332866,-0.1845781686259378,0.04830958695595969,0.325721727907434,-0.16610116149739798,-0.5631803952755421,-0.0524185034902581,-0.010056955947491591,-0.01419296407263738,-0.12137196320378947,0.028862225069198062,-0.028862225069198062,0.19725276095184807,-0.014325050573724843,-0.1346754779148611,-0.12197314546876163,0.07261034363244134,0.019520705339831707,-0.30209303317097,-0.4196164675458202,-0.11656211432894706,0.11656211432894706,-0.0019917608973461735,-0.030056860826983556,-0.17143020241436083,0.2437062066638381,0.3735871906264913,-0.19074715633383899,0.16022419622116035,0.10960903940948481,-0.10960903940948481,0.07285446185534299,0.013307637299887638,-0.048395989396186403,-0.048677676138907645,-0.1308719630307398,0.2215218879995723,0.21312546120677686,-0.21312546120677686,0.06872024488101977,0.051609553205959405,-0.008635134216455072,-0.10094330002741614,0.17152056539956614,-0.05739773844904638,0.05739773844904638,-0.055363527784059154,-0.06218754561145524,0.07617899650119048,-0.012718073865078288,0.18548377352712725,-0.18548377352712725,-0.17357921707909613,0.06322121186468962,0.2862407379004398,-0.13005412554062912,-1.0,-0.1138717060191541,-0.020557736683406817,0.06656361717114193,0.08865120931540156,0.1138717060191541,0.020557736683406817,-0.06656361717114193,-0.08865120931540156,-0.042136510218699644,-0.7768488808571018,-0.49076394325052203,-0.014095167341867058,-0.008904434409222697,-0.16416641695212653],\n",
       "\"x\":[\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"female\",\"female\",\"female\",\"female\",\"female\",\"male\",\"male\",\"male\",\"male\",\"S\",\"S\",\"S\",\"AA\",\"AA\",\"C\"],\n",
       "\"y\":[\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"S\",\"AA\",\"C\",\"Q\",\"AA\",\"C\",\"Q\",\"C\",\"Q\",\"Q\"]\n",
       "},\n",
       "\"size\":0.0,\n",
       "\"sampling\":\"none\",\n",
       "\"width\":1.002,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"tile\",\n",
       "\"tooltips\":{\n",
       "\"tooltip_lines\":[\"@corr\"],\n",
       "\"tooltip_formats\":[{\n",
       "\"field\":\"@corr\",\n",
       "\"format\":\".2f\"\n",
       "}]\n",
       "},\n",
       "\"height\":1.002\n",
       "},{\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\",\n",
       "\"label\":\"corr\",\n",
       "\"color\":\"corr\",\n",
       "\"size\":\"corr_abs\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"data\":{\n",
       "\"corr\":[0.27944860849992426,0.05079003218350772,-0.29652604123443427,-0.28342764376126967,-0.6221717617743461,-0.5631803952755421,-0.02782511923058273,-0.0342564132589007,-0.0524185034902581,0.07261034363244134,0.0826595703861011,-0.013032696181890471,-0.010056955947491591,0.019520705339831707,0.3735871906264913,-0.050198983636982906,0.3625867211172813,-0.01419296407263738,-0.30209303317097,-0.19074715633383899,-0.1308719630307398,0.24420775279437662,0.5999558397018141,-0.12137196320378947,-0.4196164675458202,0.16022419622116035,0.2215218879995723,0.17152056539956614,0.5286930913890007,0.10737066078332866,0.028862225069198062,-0.11656211432894706,0.10960903940948481,0.21312546120677686,-0.05739773844904638,0.18548377352712725,-0.5286930913890007,-0.10737066078332866,-0.028862225069198062,0.11656211432894706,-0.10960903940948481,-0.21312546120677686,0.05739773844904638,-0.18548377352712725,-1.0,-0.15255107966827613,-0.1845781686259378,0.19725276095184807,-0.0019917608973461735,0.07285446185534299,0.06872024488101977,-0.055363527784059154,-0.17357921707909613,-0.1138717060191541,0.1138717060191541,0.0351710542648909,0.04830958695595969,-0.014325050573724843,-0.030056860826983556,0.013307637299887638,0.051609553205959405,-0.06218754561145524,0.06322121186468962,-0.020557736683406817,0.020557736683406817,-0.042136510218699644,0.18212335757077264,0.325721727907434,-0.1346754779148611,-0.17143020241436083,-0.048395989396186403,-0.008635134216455072,0.07617899650119048,0.2862407379004398,0.06656361717114193,-0.06656361717114193,-0.7768488808571018,-0.014095167341867058,-0.016071471622351695,-0.16610116149739798,-0.12197314546876163,0.2437062066638381,-0.048677676138907645,-0.10094330002741614,-0.012718073865078288,-0.13005412554062912,0.08865120931540156,-0.08865120931540156,-0.49076394325052203,-0.008904434409222697,-0.16416641695212653],\n",
       "\"x\":[\"1\",\"2\",\"2\",\"3\",\"3\",\"3\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\"],\n",
       "\"y\":[\"survived\",\"survived\",\"1\",\"survived\",\"1\",\"2\",\"survived\",\"1\",\"2\",\"3\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\"]\n",
       "},\n",
       "\"size\":1.0,\n",
       "\"sampling\":\"none\",\n",
       "\"label_format\":\".2f\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"na_text\":\"\",\n",
       "\"tooltips\":{\n",
       "\"tooltip_lines\":[\"@corr\"],\n",
       "\"tooltip_formats\":[{\n",
       "\"field\":\"@corr\",\n",
       "\"format\":\".2f\"\n",
       "}]\n",
       "},\n",
       "\"size_unit\":\"x\"\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis_title\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_ticks_x\":{\n",
       "\"blank\":false\n",
       "},\n",
       "\"panel_grid\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_ticks_y\":{\n",
       "\"blank\":false\n",
       "}\n",
       "}\n",
       "},\n",
       "\"height\":600\n",
       "},{\n",
       "\"x\":0,\n",
       "\"width\":672,\n",
       "\"y\":1950,\n",
       "\"feature_spec\":{\n",
       "\"ggtitle\":{\n",
       "\"text\":\"Tiles, points and labels\"\n",
       "},\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"fixed\",\n",
       "\"xlim\":[-0.6,13.6],\n",
       "\"flip\":false,\n",
       "\"ylim\":[-0.6,13.6]\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":675.0,\n",
       "\"height\":602.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[{\n",
       "\"aesthetic\":\"color\",\n",
       "\"scale_mapper_kind\":\"color_gradient2\",\n",
       "\"high\":\"#4c4c4c\",\n",
       "\"na_value\":\"rgba(0,0,0,0)\",\n",
       "\"breaks\":[-1.0,-0.5,0.0,0.5,1.0],\n",
       "\"low\":\"#ff6632\",\n",
       "\"name\":\"\",\n",
       "\"mid\":\"#a6a6a6\",\n",
       "\"midpoint\":0.0,\n",
       "\"limits\":[-1.0,1.0],\n",
       "\"labels\":[\"-1\",\"-0.5\",\"0\",\"0.5\",\"1\"]\n",
       "},{\n",
       "\"aesthetic\":\"fill\",\n",
       "\"scale_mapper_kind\":\"color_gradient2\",\n",
       "\"high\":\"#4c4c4c\",\n",
       "\"na_value\":\"rgba(0,0,0,0)\",\n",
       "\"breaks\":[-1.0,-0.5,0.0,0.5,1.0],\n",
       "\"low\":\"#ff6632\",\n",
       "\"name\":\"\",\n",
       "\"mid\":\"#a6a6a6\",\n",
       "\"midpoint\":0.0,\n",
       "\"limits\":[-1.0,1.0],\n",
       "\"labels\":[\"-1\",\"-0.5\",\"0\",\"0.5\",\"1\"]\n",
       "},{\n",
       "\"aesthetic\":\"size\",\n",
       "\"scale_mapper_kind\":\"identity\",\n",
       "\"na_value\":0,\n",
       "\"guide\":\"none\"\n",
       "},{\n",
       "\"aesthetic\":\"x\",\n",
       "\"expand\":[0.0,0.0],\n",
       "\"breaks\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"limits\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"]\n",
       "},{\n",
       "\"aesthetic\":\"y\",\n",
       "\"expand\":[0.0,0.0],\n",
       "\"breaks\":[\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\"],\n",
       "\"limits\":[\"Q\",\"C\",\"AA\",\"S\",\"male\",\"female\",\"fare\",\"age\",\"parch\",\"sibsp\",\"3\",\"2\",\"1\",\"survived\"]\n",
       "}],\n",
       "\"layers\":[{\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\",\n",
       "\"fill\":\"corr\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"data\":{\n",
       "\"corr\":[0.27944860849992426,0.05079003218350772,-0.28342764376126967,-0.02782511923058273,0.0826595703861011,-0.050198983636982906,0.24420775279437662,0.5286930913890007,-0.5286930913890007,-0.15255107966827613,0.0351710542648909,0.18212335757077264,-0.016071471622351695,-0.29652604123443427,-0.6221717617743461,-0.0342564132589007,-0.013032696181890471,0.3625867211172813,0.5999558397018141,0.10737066078332866,-0.10737066078332866,-0.1845781686259378,0.04830958695595969,0.325721727907434,-0.16610116149739798,-0.5631803952755421,-0.0524185034902581,-0.010056955947491591,-0.01419296407263738,-0.12137196320378947,0.028862225069198062,-0.028862225069198062,0.19725276095184807,-0.014325050573724843,-0.1346754779148611,-0.12197314546876163,0.07261034363244134,0.019520705339831707,-0.30209303317097,-0.4196164675458202,-0.11656211432894706,0.11656211432894706,-0.0019917608973461735,-0.030056860826983556,-0.17143020241436083,0.2437062066638381,0.3735871906264913,-0.19074715633383899,0.16022419622116035,0.10960903940948481,-0.10960903940948481,0.07285446185534299,0.013307637299887638,-0.048395989396186403,-0.048677676138907645,-0.1308719630307398,0.2215218879995723,0.21312546120677686,-0.21312546120677686,0.06872024488101977,0.051609553205959405,-0.008635134216455072,-0.10094330002741614,0.17152056539956614,-0.05739773844904638,0.05739773844904638,-0.055363527784059154,-0.06218754561145524,0.07617899650119048,-0.012718073865078288,0.18548377352712725,-0.18548377352712725,-0.17357921707909613,0.06322121186468962,0.2862407379004398,-0.13005412554062912,-1.0,-0.1138717060191541,-0.020557736683406817,0.06656361717114193,0.08865120931540156,0.1138717060191541,0.020557736683406817,-0.06656361717114193,-0.08865120931540156,-0.042136510218699644,-0.7768488808571018,-0.49076394325052203,-0.014095167341867058,-0.008904434409222697,-0.16416641695212653],\n",
       "\"x\":[\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"survived\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"1\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"2\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"3\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"female\",\"female\",\"female\",\"female\",\"female\",\"male\",\"male\",\"male\",\"male\",\"S\",\"S\",\"S\",\"AA\",\"AA\",\"C\"],\n",
       "\"y\":[\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"female\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"male\",\"S\",\"AA\",\"C\",\"Q\",\"S\",\"AA\",\"C\",\"Q\",\"AA\",\"C\",\"Q\",\"C\",\"Q\",\"Q\"]\n",
       "},\n",
       "\"size\":0.0,\n",
       "\"sampling\":\"none\",\n",
       "\"width\":1.002,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"tile\",\n",
       "\"tooltips\":{\n",
       "\"tooltip_lines\":[\"@corr\"],\n",
       "\"tooltip_formats\":[{\n",
       "\"field\":\"@corr\",\n",
       "\"format\":\".2f\"\n",
       "}]\n",
       "},\n",
       "\"height\":1.002\n",
       "},{\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\",\n",
       "\"color\":\"corr\",\n",
       "\"size\":\"corr_abs\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"data\":{\n",
       "\"corr\":[0.27944860849992426,0.05079003218350772,-0.29652604123443427,-0.28342764376126967,-0.6221717617743461,-0.5631803952755421,-0.02782511923058273,-0.0342564132589007,-0.0524185034902581,0.07261034363244134,0.0826595703861011,-0.013032696181890471,-0.010056955947491591,0.019520705339831707,0.3735871906264913,-0.050198983636982906,0.3625867211172813,-0.01419296407263738,-0.30209303317097,-0.19074715633383899,-0.1308719630307398,0.24420775279437662,0.5999558397018141,-0.12137196320378947,-0.4196164675458202,0.16022419622116035,0.2215218879995723,0.17152056539956614,0.5286930913890007,0.10737066078332866,0.028862225069198062,-0.11656211432894706,0.10960903940948481,0.21312546120677686,-0.05739773844904638,0.18548377352712725,-0.5286930913890007,-0.10737066078332866,-0.028862225069198062,0.11656211432894706,-0.10960903940948481,-0.21312546120677686,0.05739773844904638,-0.18548377352712725,-1.0,-0.15255107966827613,-0.1845781686259378,0.19725276095184807,-0.0019917608973461735,0.07285446185534299,0.06872024488101977,-0.055363527784059154,-0.17357921707909613,-0.1138717060191541,0.1138717060191541,0.0351710542648909,0.04830958695595969,-0.014325050573724843,-0.030056860826983556,0.013307637299887638,0.051609553205959405,-0.06218754561145524,0.06322121186468962,-0.020557736683406817,0.020557736683406817,-0.042136510218699644,0.18212335757077264,0.325721727907434,-0.1346754779148611,-0.17143020241436083,-0.048395989396186403,-0.008635134216455072,0.07617899650119048,0.2862407379004398,0.06656361717114193,-0.06656361717114193,-0.7768488808571018,-0.014095167341867058,-0.016071471622351695,-0.16610116149739798,-0.12197314546876163,0.2437062066638381,-0.048677676138907645,-0.10094330002741614,-0.012718073865078288,-0.13005412554062912,0.08865120931540156,-0.08865120931540156,-0.49076394325052203,-0.008904434409222697,-0.16416641695212653],\n",
       "\"x\":[\"1\",\"2\",\"2\",\"3\",\"3\",\"3\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\"],\n",
       "\"y\":[\"survived\",\"survived\",\"1\",\"survived\",\"1\",\"2\",\"survived\",\"1\",\"2\",\"3\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\"],\n",
       "\"corr_abs\":[0.27944860849992426,0.05079003218350772,0.29652604123443427,0.28342764376126967,0.6221717617743461,0.5631803952755421,0.02782511923058273,0.0342564132589007,0.0524185034902581,0.07261034363244134,0.0826595703861011,0.013032696181890471,0.010056955947491591,0.019520705339831707,0.3735871906264913,0.050198983636982906,0.3625867211172813,0.01419296407263738,0.30209303317097,0.19074715633383899,0.1308719630307398,0.24420775279437662,0.5999558397018141,0.12137196320378947,0.4196164675458202,0.16022419622116035,0.2215218879995723,0.17152056539956614,0.5286930913890007,0.10737066078332866,0.028862225069198062,0.11656211432894706,0.10960903940948481,0.21312546120677686,0.05739773844904638,0.18548377352712725,0.5286930913890007,0.10737066078332866,0.028862225069198062,0.11656211432894706,0.10960903940948481,0.21312546120677686,0.05739773844904638,0.18548377352712725,1.0,0.15255107966827613,0.1845781686259378,0.19725276095184807,0.0019917608973461735,0.07285446185534299,0.06872024488101977,0.055363527784059154,0.17357921707909613,0.1138717060191541,0.1138717060191541,0.0351710542648909,0.04830958695595969,0.014325050573724843,0.030056860826983556,0.013307637299887638,0.051609553205959405,0.06218754561145524,0.06322121186468962,0.020557736683406817,0.020557736683406817,0.042136510218699644,0.18212335757077264,0.325721727907434,0.1346754779148611,0.17143020241436083,0.048395989396186403,0.008635134216455072,0.07617899650119048,0.2862407379004398,0.06656361717114193,0.06656361717114193,0.7768488808571018,0.014095167341867058,0.016071471622351695,0.16610116149739798,0.12197314546876163,0.2437062066638381,0.048677676138907645,0.10094330002741614,0.012718073865078288,0.13005412554062912,0.08865120931540156,0.08865120931540156,0.49076394325052203,0.008904434409222697,0.16416641695212653]\n",
       "},\n",
       "\"sampling\":\"none\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"point\",\n",
       "\"tooltips\":{\n",
       "\"tooltip_lines\":[\"@corr\"],\n",
       "\"tooltip_formats\":[{\n",
       "\"field\":\"@corr\",\n",
       "\"format\":\".2f\"\n",
       "}]\n",
       "},\n",
       "\"size_unit\":\"x\"\n",
       "},{\n",
       "\"mapping\":{\n",
       "\"x\":\"x\",\n",
       "\"y\":\"y\",\n",
       "\"label\":\"corr\",\n",
       "\"color\":\"corr\",\n",
       "\"size\":\"corr_abs\"\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"data\":{\n",
       "\"corr\":[0.27944860849992426,0.05079003218350772,-0.29652604123443427,-0.28342764376126967,-0.6221717617743461,-0.5631803952755421,-0.02782511923058273,-0.0342564132589007,-0.0524185034902581,0.07261034363244134,0.0826595703861011,-0.013032696181890471,-0.010056955947491591,0.019520705339831707,0.3735871906264913,-0.050198983636982906,0.3625867211172813,-0.01419296407263738,-0.30209303317097,-0.19074715633383899,-0.1308719630307398,0.24420775279437662,0.5999558397018141,-0.12137196320378947,-0.4196164675458202,0.16022419622116035,0.2215218879995723,0.17152056539956614,0.5286930913890007,0.10737066078332866,0.028862225069198062,-0.11656211432894706,0.10960903940948481,0.21312546120677686,-0.05739773844904638,0.18548377352712725,-0.5286930913890007,-0.10737066078332866,-0.028862225069198062,0.11656211432894706,-0.10960903940948481,-0.21312546120677686,0.05739773844904638,-0.18548377352712725,-1.0,-0.15255107966827613,-0.1845781686259378,0.19725276095184807,-0.0019917608973461735,0.07285446185534299,0.06872024488101977,-0.055363527784059154,-0.17357921707909613,-0.1138717060191541,0.1138717060191541,0.0351710542648909,0.04830958695595969,-0.014325050573724843,-0.030056860826983556,0.013307637299887638,0.051609553205959405,-0.06218754561145524,0.06322121186468962,-0.020557736683406817,0.020557736683406817,-0.042136510218699644,0.18212335757077264,0.325721727907434,-0.1346754779148611,-0.17143020241436083,-0.048395989396186403,-0.008635134216455072,0.07617899650119048,0.2862407379004398,0.06656361717114193,-0.06656361717114193,-0.7768488808571018,-0.014095167341867058,-0.016071471622351695,-0.16610116149739798,-0.12197314546876163,0.2437062066638381,-0.048677676138907645,-0.10094330002741614,-0.012718073865078288,-0.13005412554062912,0.08865120931540156,-0.08865120931540156,-0.49076394325052203,-0.008904434409222697,-0.16416641695212653],\n",
       "\"x\":[\"1\",\"2\",\"2\",\"3\",\"3\",\"3\",\"sibsp\",\"sibsp\",\"sibsp\",\"sibsp\",\"parch\",\"parch\",\"parch\",\"parch\",\"parch\",\"age\",\"age\",\"age\",\"age\",\"age\",\"age\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"fare\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"female\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"male\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"S\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"AA\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"C\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\",\"Q\"],\n",
       "\"y\":[\"survived\",\"survived\",\"1\",\"survived\",\"1\",\"2\",\"survived\",\"1\",\"2\",\"3\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"survived\",\"1\",\"2\",\"3\",\"sibsp\",\"parch\",\"age\",\"fare\",\"female\",\"male\",\"S\",\"AA\",\"C\"],\n",
       "\"corr_abs\":[0.27944860849992426,0.05079003218350772,0.29652604123443427,0.28342764376126967,0.6221717617743461,0.5631803952755421,0.02782511923058273,0.0342564132589007,0.0524185034902581,0.07261034363244134,0.0826595703861011,0.013032696181890471,0.010056955947491591,0.019520705339831707,0.3735871906264913,0.050198983636982906,0.3625867211172813,0.01419296407263738,0.30209303317097,0.19074715633383899,0.1308719630307398,0.24420775279437662,0.5999558397018141,0.12137196320378947,0.4196164675458202,0.16022419622116035,0.2215218879995723,0.17152056539956614,0.5286930913890007,0.10737066078332866,0.028862225069198062,0.11656211432894706,0.10960903940948481,0.21312546120677686,0.05739773844904638,0.18548377352712725,0.5286930913890007,0.10737066078332866,0.028862225069198062,0.11656211432894706,0.10960903940948481,0.21312546120677686,0.05739773844904638,0.18548377352712725,1.0,0.15255107966827613,0.1845781686259378,0.19725276095184807,0.0019917608973461735,0.07285446185534299,0.06872024488101977,0.055363527784059154,0.17357921707909613,0.1138717060191541,0.1138717060191541,0.0351710542648909,0.04830958695595969,0.014325050573724843,0.030056860826983556,0.013307637299887638,0.051609553205959405,0.06218754561145524,0.06322121186468962,0.020557736683406817,0.020557736683406817,0.042136510218699644,0.18212335757077264,0.325721727907434,0.1346754779148611,0.17143020241436083,0.048395989396186403,0.008635134216455072,0.07617899650119048,0.2862407379004398,0.06656361717114193,0.06656361717114193,0.7768488808571018,0.014095167341867058,0.016071471622351695,0.16610116149739798,0.12197314546876163,0.2437062066638381,0.048677676138907645,0.10094330002741614,0.012718073865078288,0.13005412554062912,0.08865120931540156,0.08865120931540156,0.49076394325052203,0.008904434409222697,0.16416641695212653]\n",
       "},\n",
       "\"color\":\"white\",\n",
       "\"sampling\":\"none\",\n",
       "\"label_format\":\".2f\",\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"text\",\n",
       "\"na_text\":\"\",\n",
       "\"tooltips\":{\n",
       "\"tooltip_lines\":[\"@corr\"],\n",
       "\"tooltip_formats\":[{\n",
       "\"field\":\"@corr\",\n",
       "\"format\":\".2f\"\n",
       "}]\n",
       "},\n",
       "\"size_unit\":\"x\"\n",
       "}],\n",
       "\"theme\":{\n",
       "\"axis_title\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_ticks_x\":{\n",
       "\"blank\":false\n",
       "},\n",
       "\"panel_grid\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_line\":{\n",
       "\"blank\":true\n",
       "},\n",
       "\"axis_ticks_y\":{\n",
       "\"blank\":false\n",
       "}\n",
       "}\n",
       "},\n",
       "\"height\":600\n",
       "}]\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"BsaEzH\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val titanicData = df2.flatten().toMap()\n",
    "\n",
    "gggrid(\n",
    "    listOf(\n",
    "        CorrPlot(titanicData, \"Tiles\").tiles()\n",
    "            .paletteGradient(colors[\"orange\"]!!, colors[\"light_grey\"]!!, colors[\"dark_grey\"]!!).build(),\n",
    "        CorrPlot(titanicData, \"Points\").points()\n",
    "            .paletteGradient(colors[\"orange\"]!!, colors[\"light_grey\"]!!, colors[\"dark_grey\"]!!).build(), \n",
    "        CorrPlot(titanicData, \"Tiles and labels\").tiles().labels()\n",
    "            .paletteGradient(colors[\"orange\"]!!, colors[\"light_grey\"]!!, colors[\"dark_grey\"]!!).build(),\n",
    "        CorrPlot(titanicData, \"Tiles, points and labels\").points().labels().tiles()\n",
    "            .paletteGradient(colors[\"orange\"]!!, colors[\"light_grey\"]!!, colors[\"dark_grey\"]!!).build()\n",
    "    ), 1, 700, 600)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Creation of new features\n",
    "\n",
    "We suggest to combine both, **Sibsp** and **parch** features, into the new one feature with the name **FamilyNumber** as a simple sum of **sibsp** and **parch**."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410161\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 15</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"pclass: Int\\\">pclass</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"name: String\\\">name</span>\", children: [], rightAlign: false, values: [\"Allen, Miss. Elisabeth Walton\",\"Allison, Master. Hudson Trevor\",\"Allison, Miss. Helen Loraine\",\"Allison, Mr. Hudson Joshua Creighton\",\"<span class=\\\"formatted\\\" title=\\\"Allison, Mrs. Hudson J C (Bessie Waldo Daniels)\\\">Allison, Mrs. Hudson J C (Bessie Wald<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sex: String\\\">sex</span>\", children: [], rightAlign: false, values: [\"female\",\"male\",\"female\",\"male\",\"female\"] }, \n",
       "{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">29.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.9167</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">30.0000</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">25.0000</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"sibsp: Double\\\">sibsp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"parch: Double\\\">parch</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2.0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"ticket: String\\\">ticket</span>\", children: [], rightAlign: false, values: [\"24160\",\"113781\",\"113781\",\"113781\",\"113781\"] }, \n",
       "{ name: \"<span title=\\\"fare: Double\\\">fare</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">211.3375</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">151.5500</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"cabin: String\\\">cabin</span>\", children: [], rightAlign: false, values: [\"B5\",\"C22 C26\",\"C22 C26\",\"C22 C26\",\"C22 C26\"] }, \n",
       "{ name: \"<span title=\\\"embarked: String\\\">embarked</span>\", children: [], rightAlign: false, values: [\"S\",\"AA\",\"S\",\"S\",\"S\"] }, \n",
       "{ name: \"<span title=\\\"boat: String?\\\">boat</span>\", children: [], rightAlign: false, values: [\"2\",\"11\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"body: Int?\\\">body</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">135</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">null</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"homedest: String\\\">homedest</span>\", children: [], rightAlign: false, values: [\"St Louis, MO\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\",\"Montreal, PQ / Chesterville, ON\"] }, \n",
       "{ name: \"<span title=\\\"familyNumber: Double\\\">familyNumber</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3.0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3.0</span></span>\"] }, \n",
       "], id: -1023410161, rootId: -1023410161, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410161) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val familyDF = df1.add(\"familyNumber\") { sibsp + parch }\n",
    "\n",
    "familyDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410160\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 1, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"column: String\\\">column</span>\", children: [], rightAlign: false, values: [\"familyNumber\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.026876</span></span>\"] }, \n",
       "], id: -1023410160, rootId: -1023410160, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410160) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "familyDF.corr { familyNumber }.with { survived }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410159\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 1, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"column: String\\\">column</span>\", children: [], rightAlign: false, values: [\"familyNumber\"] }, \n",
       "{ name: \"<span title=\\\"age: Double\\\">age</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.196996</span></span>\"] }, \n",
       "], id: -1023410159, rootId: -1023410159, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410159) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "familyDF.corr { familyNumber }.with { age }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Looks like the new feature has no influence on the **survived** column, but it has a strong negative correlation with **age**. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Titles\n",
    "Let's try to extract something from the names. A lot of string in the name column contains special titles, like Done, Mr, Mrs and so on."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410158\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 100 rows</p><p>DataFrame: rowsCount = 100, columnsCount = 3</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"name: String\\\">name</span>\", children: [], rightAlign: false, values: [\"Allen, Miss. Elisabeth Walton\",\"Allison, Master. Hudson Trevor\",\"Allison, Miss. Helen Loraine\",\"Allison, Mr. Hudson Joshua Creighton\",\"<span class=\\\"formatted\\\" title=\\\"Allison, Mrs. Hudson J C (Bessie Waldo Daniels)\\\">Allison, Mrs. Hudson J C (Bessie Wald<span class=\\\"structural\\\">...</span></span>\",\"Anderson, Mr. Harry\",\"Andrews, Miss. Kornelia Theodosia\",\"Andrews, Mr. Thomas Jr\",\"<span class=\\\"formatted\\\" title=\\\"Appleton, Mrs. Edward Dale (Charlotte Lamson)\\\">Appleton, Mrs. Edward Dale (Charlotte<span class=\\\"structural\\\">...</span></span>\",\"Artagaveytia, Mr. Ramon\",\"Astor, Col. John Jacob\",\"<span class=\\\"formatted\\\" title=\\\"Astor, Mrs. John Jacob (Madeleine Talmadge Force)\\\">Astor, Mrs. John Jacob (Madeleine Tal<span class=\\\"structural\\\">...</span></span>\",\"Aubart, Mme. Leontine Pauline\",\"Barber, Miss. Ellen &#34;Nellie&#34;\",\"Barkworth, Mr. Algernon Henry Wilson\",\"Baumann, Mr. John D\",\"Baxter, Mr. Quigg Edmond\",\"<span class=\\\"formatted\\\" title=\\\"Baxter, Mrs. James (Helene DeLaudeniere Chaput)\\\">Baxter, Mrs. James (Helene DeLaudenie<span class=\\\"structural\\\">...</span></span>\",\"Bazzani, Miss. Albina\",\"Beattie, Mr. Thomson\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Miss\",\"Master\",\"Miss\",\"Mr\",\"Mrs\",\"Mr\",\"Miss\",\"Mr\",\"Mrs\",\"Mr\",\"Col\",\"Mrs\",\"Mme\",\"Miss\",\"Mr\",\"Mr\",\"Mr\",\"Mrs\",\"Miss\",\"Mr\"] }, \n",
       "], id: -1023410158, rootId: -1023410158, totalRows: 100 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410158) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val titledDF = df.select { survived and name }.add (\"title\") { name.split(\".\")[0].split(\",\")[1].trim() }\n",
    "titledDF.head(100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410157\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 18, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Mr\",\"Miss\",\"Mrs\",\"Master\",\"Dr\",\"Rev\",\"Col\",\"Major\",\"Mlle\",\"Ms\",\"Mme\",\"Capt\",\"Lady\",\"Sir\",\"Dona\",\"Jonkheer\",\"the Countess\",\"Don\"] }, \n",
       "{ name: \"<span title=\\\"count: Int\\\">count</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">757</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">260</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">197</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">61</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "], id: -1023410157, rootId: -1023410157, totalRows: 18 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410157) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titledDF.valueCounts { title }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "New **Title** column contains some rare titles and some titles with typos. Let's clean the data and merge rare titles into one category."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "val rareTitles = listOf(\"Dona\", \"Lady\", \"the Countess\", \"Capt\", \"Col\", \"Don\", \n",
    "                \"Dr\", \"Major\", \"Rev\", \"Sir\", \"Jonkheer\")\n",
    "\n",
    "val cleanedTitledDF = titledDF.update { title }.with { \n",
    "                            when {\n",
    "                                it == \"Mlle\" -> \"Miss\"\n",
    "                                it == \"Ms\" -> \"Miss\"\n",
    "                                it == \"Mme\" -> \"Mrs\"\n",
    "                                it in rareTitles -> \"Rare Title\"\n",
    "                                else -> it\n",
    "                            }\n",
    "                        }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410156\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Mr\",\"Miss\",\"Mrs\",\"Master\",\"Rare Title\"] }, \n",
       "{ name: \"<span title=\\\"count: Int\\\">count</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">757</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">264</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">198</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">61</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">29</span></span>\"] }, \n",
       "], id: -1023410156, rootId: -1023410156, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410156) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cleanedTitledDF.valueCounts { title }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now it looks awesome and we have only 5 different titles and could see how it correlates with survival."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410155\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Miss\",\"Master\",\"Mr\",\"Mrs\",\"Rare Title\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.306069</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.057318</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.528775</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.352536</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.000915</span></span>\"] }, \n",
       "], id: -1023410155, rootId: -1023410155, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410155) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val correlations = cleanedTitledDF\n",
    "                    .pivotMatches { title }\n",
    "                    .corr { title }.with { survived }\n",
    "correlations"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410154\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Miss\",\"Master\",\"Mr\",\"Mrs\",\"Rare Title\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.306069</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.057318</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.528775</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.352536</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.000915</span></span>\"] }, \n",
       "], id: -1023410154, rootId: -1023410154, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410154) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "correlations.update { title }.with { it.substringAfter('_') }.filter { title != \"survived\" }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The women with title **Miss** and **Mrs** have the same chances to survive, but not the same for the men. If you have a title **Mr**, your deals are bad on the Titanic.\n",
    "\n",
    "**Rare title** is really rare and doesn't play a big role."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410153\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 10, columnsCount = 3</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Master\",\"Master\",\"Miss\",\"Miss\",\"Mr\",\"Mr\",\"Mrs\",\"Mrs\",\"Rare Title\",\"Rare Title\"] }, \n",
       "{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"count: Int\\\">count</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">30</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">31</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">85</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">179</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">634</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">123</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">42</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">156</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">18</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">11</span></span>\"] }, \n",
       "], id: -1023410153, rootId: -1023410153, totalRows: 10 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410153) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val groupedCleanedTitledDF = cleanedTitledDF.valueCounts { title and survived }.sortBy { title and survived }\n",
    "groupedCleanedTitledDF"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Surname's analysis\n",
    "It's very interesting to dig deeper into families, home destinations, and we could do start this analysis from surnames which could be easily extracted from **Name** feature."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410152\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 3</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"survived: Int\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"name: String\\\">name</span>\", children: [], rightAlign: false, values: [\"Allen, Miss. Elisabeth Walton\",\"Allison, Master. Hudson Trevor\",\"Allison, Miss. Helen Loraine\",\"Allison, Mr. Hudson Joshua Creighton\",\"<span class=\\\"formatted\\\" title=\\\"Allison, Mrs. Hudson J C (Bessie Waldo Daniels)\\\">Allison, Mrs. Hudson J C (Bessie Wald<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"surname: String\\\">surname</span>\", children: [], rightAlign: false, values: [\"Allen\",\"Allison\",\"Allison\",\"Allison\",\"Allison\"] }, \n",
       "], id: -1023410152, rootId: -1023410152, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410152) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val surnameDF = df1.select { survived and name }.add (\"surname\") { name.split(\".\")[0].split(\",\")[0].trim() }\n",
    "surnameDF.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410151\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 875 rows</p><p>DataFrame: rowsCount = 875, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"surname: String\\\">surname</span>\", children: [], rightAlign: false, values: [\"Andersson\",\"Sage\",\"Asplund\",\"Goodwin\",\"Davies\",\"Brown\",\"Carter\",\"Fortune\",\"Smith\",\"Ford\",\"Johnson\",\"Panula\",\"Rice\",\"Skoog\",\"Ryerson\",\"Williams\",\"Kelly\",\"Lefebre\",\"Palsson\",\"Thomas\"] }, \n",
       "{ name: \"<span title=\\\"count: Int\\\">count</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">11</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">11</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">8</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">7</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">5</span></span>\"] }, \n",
       "], id: -1023410151, rootId: -1023410151, totalRows: 875 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410151) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "surnameDF.valueCounts { surname }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "875"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "surnameDF.surname.countDistinct()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-1023410150\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 27 rows</p><p>DataFrame: rowsCount = 27, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"firstSymbol: String\\\">firstSymbol</span>\", children: [], rightAlign: false, values: [\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"R\",\"S\",\"T\",\"U\"] }, \n",
       "{ name: \"<span title=\\\"survived: Double\\\">survived</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.017914</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.050554</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.009037</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.051711</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.034629</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000400</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.044483</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.042187</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.008329</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.026790</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.014219</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.021071</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.019041</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.028698</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.000128</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.058996</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.021941</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.020043</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0.052264</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">-0.021737</span></span>\"] }, \n",
       "], id: -1023410150, rootId: -1023410150, totalRows: 27 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-1023410150) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val firstSymbol by column<String>()\n",
    "\n",
    "df1\n",
    ".add (firstSymbol) { name.split(\".\")[0].split(\",\")[0].trim().first().toString() }\n",
    ".pivotMatches(firstSymbol)\n",
    ".corr { firstSymbol }.with { survived }\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "nbconvert_exporter": "",
   "pygments_lexer": "kotlin",
   "version": "1.8.0-dev-707"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
